public abstract class AbstractRpcRemoting extends Object implements Disposable
| 限定符和类型 | 字段和说明 |
|---|---|
protected ConcurrentHashMap<String,BlockingQueue<RpcMessage>> |
basketMap
The Basket map.
|
protected ConcurrentHashMap<Integer,MessageFuture> |
futures
The Futures.
|
protected PositiveAtomicCounter |
idGenerator
Id generator of this remoting
|
protected boolean |
isSending
The Is sending.
|
protected Object |
mergeLock
The Merge lock.
|
protected Map<Integer,MergeMessage> |
mergeMsgMap
The Merge msg map.
|
protected ThreadPoolExecutor |
messageExecutor
The Message executor.
|
protected long |
nowMills
The Now mills.
|
protected ScheduledExecutorService |
timerExecutor
The Timer executor.
|
| 构造器和说明 |
|---|
AbstractRpcRemoting(ThreadPoolExecutor messageExecutor)
Instantiates a new Abstract rpc remoting.
|
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
defaultSendRequest(io.netty.channel.Channel channel,
Object msg)
Default Send request.
|
protected void |
defaultSendResponse(RpcMessage request,
io.netty.channel.Channel channel,
Object msg)
Default Send response.
|
void |
destroy()
Destroy.
|
void |
destroyChannel(io.netty.channel.Channel channel)
Destroy channel.
|
abstract void |
destroyChannel(String serverAddress,
io.netty.channel.Channel channel)
Destroy channel.
|
protected String |
getAddressFromChannel(io.netty.channel.Channel channel)
Gets address from channel.
|
protected String |
getAddressFromContext(io.netty.channel.ChannelHandlerContext ctx)
Gets address from context.
|
String |
getGroup()
Gets group.
|
int |
getNextMessageId()
Gets next message id.
|
void |
init()
Init.
|
protected Object |
sendAsyncRequestWithoutResponse(io.netty.channel.Channel channel,
Object msg)
Send async request without response object.
|
protected Object |
sendAsyncRequestWithResponse(io.netty.channel.Channel channel,
Object msg)
Send async request with response object.
|
protected Object |
sendAsyncRequestWithResponse(String address,
io.netty.channel.Channel channel,
Object msg,
long timeout)
Send async request with response object.
|
void |
setGroup(String group)
Sets group.
|
protected final ScheduledExecutorService timerExecutor
protected final ThreadPoolExecutor messageExecutor
protected final PositiveAtomicCounter idGenerator
protected final ConcurrentHashMap<Integer,MessageFuture> futures
protected final ConcurrentHashMap<String,BlockingQueue<RpcMessage>> basketMap
protected final Object mergeLock
protected volatile long nowMills
protected volatile boolean isSending
protected final Map<Integer,MergeMessage> mergeMsgMap
public AbstractRpcRemoting(ThreadPoolExecutor messageExecutor)
messageExecutor - the message executorpublic int getNextMessageId()
public void init()
public void destroy()
destroy 在接口中 Disposableprotected Object sendAsyncRequestWithResponse(io.netty.channel.Channel channel, Object msg) throws TimeoutException
channel - the channelmsg - the msgTimeoutException - the timeout exceptionprotected Object sendAsyncRequestWithResponse(String address, io.netty.channel.Channel channel, Object msg, long timeout) throws TimeoutException
address - the addresschannel - the channelmsg - the msgtimeout - the timeoutTimeoutException - the timeout exceptionprotected Object sendAsyncRequestWithoutResponse(io.netty.channel.Channel channel, Object msg) throws TimeoutException
channel - the channelmsg - the msgTimeoutException - the timeout exceptionprotected void defaultSendRequest(io.netty.channel.Channel channel,
Object msg)
channel - the channelmsg - the msgprotected void defaultSendResponse(RpcMessage request, io.netty.channel.Channel channel, Object msg)
request - the msg idchannel - the channelmsg - the msgpublic String getGroup()
public void setGroup(String group)
group - the grouppublic void destroyChannel(io.netty.channel.Channel channel)
channel - the channelpublic abstract void destroyChannel(String serverAddress, io.netty.channel.Channel channel)
serverAddress - the server addresschannel - the channelprotected String getAddressFromContext(io.netty.channel.ChannelHandlerContext ctx)
ctx - the ctxprotected String getAddressFromChannel(io.netty.channel.Channel channel)
channel - the channelCopyright © 2020 Seata. All rights reserved.