mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-15 00:04:46 +08:00
优化rpc内存池
This commit is contained in:
@@ -1,26 +1,20 @@
|
||||
package rpc
|
||||
|
||||
import (
|
||||
"github.com/duanhf2012/origin/util/sync"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type GoGoPBProcessor struct {
|
||||
}
|
||||
|
||||
var rpcGoGoPbResponseDataPool sync.Pool
|
||||
var rpcGoGoPbRequestDataPool sync.Pool
|
||||
var rpcGoGoPbResponseDataPool =sync.NewPool(make(chan interface{},10240), func()interface{}{
|
||||
return &GoGoPBRpcResponseData{}
|
||||
})
|
||||
|
||||
|
||||
func init(){
|
||||
rpcGoGoPbResponseDataPool.New = func()interface{}{
|
||||
return &GoGoPBRpcResponseData{}
|
||||
}
|
||||
|
||||
rpcGoGoPbRequestDataPool.New = func()interface{}{
|
||||
return &GoGoPBRpcRequestData{}
|
||||
}
|
||||
}
|
||||
var rpcGoGoPbRequestDataPool =sync.NewPool(make(chan interface{},10240), func()interface{}{
|
||||
return &GoGoPBRpcRequestData{}
|
||||
})
|
||||
|
||||
func (slf *GoGoPBRpcRequestData) MakeRequest(seq uint64,rpcMethodId uint32,serviceMethod string,noReply bool,inParam []byte) *GoGoPBRpcRequestData{
|
||||
slf.Seq = seq
|
||||
|
||||
Reference in New Issue
Block a user