-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a811185
commit fb919f0
Showing
6 changed files
with
39 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
benchmark/toy-rpc-client/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
rpc.application.name=benchmark_consumer | ||
rpc.application.serialize=protostuff | ||
rpc.application.serialize=json | ||
rpc.application.proxy=javassist | ||
rpc.protocol.type=toy | ||
rpc.protocol.executor.server.type=threadpool | ||
rpc.protocol.executor.client.type=threadpool | ||
#rpc.registry.address=127.0.0.1:2181 | ||
rpc.registry.address=192.168.1.117:2181 | ||
rpc.registry.address=127.0.0.1:2181 | ||
#rpc.registry.address=192.168.1.117:2181 | ||
rpc.cluster.loadbalance=consistent_hash | ||
rpc.cluster.faulttolerance=failover |
2 changes: 1 addition & 1 deletion
2
benchmark/toy-rpc-server/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
toy-rpc-core/src/main/java/com/sinjinsong/toy/serialize/json/JsonSerializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.sinjinsong.toy.serialize.json; | ||
|
||
import com.alibaba.fastjson.JSONObject; | ||
import com.sinjinsong.toy.common.exception.RPCException; | ||
import com.sinjinsong.toy.serialize.api.Serializer; | ||
|
||
/** | ||
* @author sinjinsong | ||
* @date 2018/8/23 | ||
*/ | ||
public class JsonSerializer implements Serializer { | ||
@Override | ||
public <T> byte[] serialize(T obj) throws RPCException { | ||
return JSONObject.toJSONBytes(obj); | ||
} | ||
|
||
@Override | ||
public <T> T deserialize(byte[] data, Class<T> cls) throws RPCException { | ||
return JSONObject.parseObject(data, cls); | ||
} | ||
} |