mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-04 06:54:45 +08:00
1.删除msgp序列化方式
2.优化临时内存池减少GC
This commit is contained in:
@@ -17,6 +17,7 @@ type JsonRpcRequestData struct {
|
||||
InParam []byte
|
||||
}
|
||||
|
||||
|
||||
type JsonRpcResponseData struct {
|
||||
//head
|
||||
Seq uint64 // sequence number chosen by client
|
||||
@@ -27,7 +28,6 @@ type JsonRpcResponseData struct {
|
||||
}
|
||||
|
||||
|
||||
|
||||
var rpcJsonResponeDataPool sync.Pool
|
||||
var rpcJsonRequestDataPool sync.Pool
|
||||
|
||||
@@ -51,13 +51,14 @@ func (slf *JsonProcessor) Unmarshal(data []byte, v interface{}) error{
|
||||
return json.Unmarshal(data,v)
|
||||
}
|
||||
|
||||
|
||||
|
||||
func (slf *JsonProcessor) MakeRpcRequest(seq uint64,serviceMethod string,noReply bool,inParam []byte) IRpcRequestData{
|
||||
jsonRpcRequestData := rpcJsonRequestDataPool.Get().(*JsonRpcRequestData)
|
||||
jsonRpcRequestData.Seq = seq
|
||||
jsonRpcRequestData.ServiceMethod = serviceMethod
|
||||
jsonRpcRequestData.NoReply = noReply
|
||||
jsonRpcRequestData.InParam = inParam
|
||||
|
||||
return jsonRpcRequestData
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user