public abstract class AbstractRpcRemoting extends io.netty.channel.ChannelDuplexHandler implements Disposable
| 限定符和类型 | 字段和说明 |
|---|---|
protected ConcurrentHashMap<String,BlockingQueue<RpcMessage>> |
basketMap
The Basket map.
|
protected io.netty.channel.ChannelHandler[] |
channelHandlers
The Channel handlers.
|
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 |
addChannelPipelineLast(io.netty.channel.Channel channel,
io.netty.channel.ChannelHandler... handlers)
Add channel pipeline last.
|
void |
channelRead(io.netty.channel.ChannelHandlerContext ctx,
Object msg) |
void |
channelWritabilityChanged(io.netty.channel.ChannelHandlerContext ctx) |
void |
close(io.netty.channel.ChannelHandlerContext ctx,
io.netty.channel.ChannelPromise future) |
void |
destroy()
Destroy.
|
void |
destroyChannel(io.netty.channel.Channel channel)
Destroy channel.
|
abstract void |
destroyChannel(String serverAddress,
io.netty.channel.Channel channel)
Destroy channel.
|
abstract void |
dispatch(RpcMessage request,
io.netty.channel.ChannelHandlerContext ctx)
Dispatch.
|
void |
exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause) |
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.
|
protected void |
sendRequest(io.netty.channel.Channel channel,
Object msg)
Send request.
|
protected void |
sendResponse(RpcMessage request,
io.netty.channel.Channel channel,
Object msg)
Send response.
|
protected void |
setChannelHandlers(io.netty.channel.ChannelHandler... handlers)
Sets channel handlers.
|
void |
setGroup(String group)
Sets group.
|
bind, connect, deregister, disconnect, flush, read, writechannelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, userEventTriggeredensureNotSharable, handlerAdded, handlerRemoved, isSharableprotected 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
protected io.netty.channel.ChannelHandler[] channelHandlers
public AbstractRpcRemoting(ThreadPoolExecutor messageExecutor)
messageExecutor - the message executorpublic int getNextMessageId()
public void init()
public void destroy()
destroy 在接口中 Disposablepublic void channelWritabilityChanged(io.netty.channel.ChannelHandlerContext ctx)
channelWritabilityChanged 在接口中 io.netty.channel.ChannelInboundHandlerchannelWritabilityChanged 在类中 io.netty.channel.ChannelInboundHandlerAdapterprotected 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 sendRequest(io.netty.channel.Channel channel,
Object msg)
channel - the channelmsg - the msgprotected void sendResponse(RpcMessage request, io.netty.channel.Channel channel, Object msg)
request - the msg idchannel - the channelmsg - the msgpublic void channelRead(io.netty.channel.ChannelHandlerContext ctx,
Object msg)
throws Exception
channelRead 在接口中 io.netty.channel.ChannelInboundHandlerchannelRead 在类中 io.netty.channel.ChannelInboundHandlerAdapterExceptionpublic void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause)
throws Exception
exceptionCaught 在接口中 io.netty.channel.ChannelHandlerexceptionCaught 在接口中 io.netty.channel.ChannelInboundHandlerexceptionCaught 在类中 io.netty.channel.ChannelInboundHandlerAdapterExceptionpublic abstract void dispatch(RpcMessage request, io.netty.channel.ChannelHandlerContext ctx)
request - the requestctx - the ctxpublic void close(io.netty.channel.ChannelHandlerContext ctx,
io.netty.channel.ChannelPromise future)
throws Exception
close 在接口中 io.netty.channel.ChannelOutboundHandlerclose 在类中 io.netty.channel.ChannelDuplexHandlerExceptionprotected void addChannelPipelineLast(io.netty.channel.Channel channel,
io.netty.channel.ChannelHandler... handlers)
channel - the channelhandlers - the handlersprotected void setChannelHandlers(io.netty.channel.ChannelHandler... handlers)
handlers - the handlerspublic 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 © 2019 Seata. All rights reserved.