public abstract class AbstractNettyRemotingClient extends AbstractNettyRemoting implements RemotingClient
| Modifier and Type | Field and Description |
|---|---|
protected ConcurrentHashMap<String,BlockingQueue<RpcMessage>> |
basketMap
When batch sending is enabled, the message will be stored to basketMap
Send via asynchronous thread
AbstractNettyRemotingClient.MergedSendRunnable
isEnableClientBatchSendRequest() |
protected boolean |
enableClientBatchSendRequest |
protected Object |
mergeLock |
protected Map<Integer,MergeMessage> |
mergeMsgMap
When sending message type is
MergeMessage, will be stored to mergeMsgMap. |
futures, idGenerator, isSending, lock, messageExecutor, nowMills, processorTable, rpcHooks, timerExecutor| Constructor and Description |
|---|
AbstractNettyRemotingClient(NettyClientConfig nettyClientConfig,
io.netty.util.concurrent.EventExecutorGroup eventExecutorGroup,
ThreadPoolExecutor messageExecutor,
NettyPoolKey.TransactionRole transactionRole) |
| Modifier and Type | Method and Description |
|---|---|
void |
destroy() |
void |
destroyChannel(String serverAddress,
io.netty.channel.Channel channel)
Destroy channel.
|
protected InetSocketAddress |
doSelect(List<InetSocketAddress> list,
Object msg) |
io.seata.core.rpc.netty.NettyClientChannelManager |
getClientChannelManager() |
protected abstract Function<String,NettyPoolKey> |
getPoolKeyFunction()
Get pool key function.
|
protected abstract long |
getRpcRequestTimeout()
get Rpc Request Timeout
|
TransactionMessageHandler |
getTransactionMessageHandler() |
protected abstract String |
getTransactionServiceGroup()
Get transaction service group.
|
protected String |
getXid(Object msg) |
void |
init() |
protected abstract boolean |
isEnableClientBatchSendRequest()
Whether to enable batch sending of requests, hand over to subclass implementation.
|
protected String |
loadBalance(String transactionServiceGroup,
Object msg) |
void |
registerProcessor(int requestCode,
RemotingProcessor processor,
ExecutorService executor)
register processor
|
void |
sendAsyncRequest(io.netty.channel.Channel channel,
Object msg)
client send async request.
|
void |
sendAsyncResponse(String serverAddress,
RpcMessage rpcMessage,
Object msg)
client send async response.
|
Object |
sendSyncRequest(io.netty.channel.Channel channel,
Object msg)
client send sync request.
|
Object |
sendSyncRequest(Object msg)
client send sync request.
|
void |
setTransactionMessageHandler(TransactionMessageHandler transactionMessageHandler) |
buildRequestMessage, buildResponseMessage, destroyChannel, doAfterRpcHooks, doBeforeRpcHooks, getAddressFromChannel, getAddressFromContext, getFutures, getGroup, getNextMessageId, processMessage, sendAsync, sendSync, setGroupclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonRegisterMsgFail, onRegisterMsgSuccessprotected final Object mergeLock
protected final Map<Integer,MergeMessage> mergeMsgMap
MergeMessage, will be stored to mergeMsgMap.protected final ConcurrentHashMap<String,BlockingQueue<RpcMessage>> basketMap
AbstractNettyRemotingClient.MergedSendRunnable
isEnableClientBatchSendRequest()protected volatile boolean enableClientBatchSendRequest
public AbstractNettyRemotingClient(NettyClientConfig nettyClientConfig, io.netty.util.concurrent.EventExecutorGroup eventExecutorGroup, ThreadPoolExecutor messageExecutor, NettyPoolKey.TransactionRole transactionRole)
public void init()
init in class AbstractNettyRemotingpublic Object sendSyncRequest(Object msg) throws TimeoutException
RemotingClientRmNettyRemotingClient.isEnableClientBatchSendRequest()
TmNettyRemotingClient.isEnableClientBatchSendRequest()
is enabled, the message will be sent in batches.sendSyncRequest in interface RemotingClientmsg - transaction message io.seata.core.protocolTimeoutException - TimeoutExceptionpublic Object sendSyncRequest(io.netty.channel.Channel channel, Object msg) throws TimeoutException
RemotingClientsendSyncRequest in interface RemotingClientchannel - client channelmsg - transaction message io.seata.core.protocolTimeoutException - TimeoutExceptionpublic void sendAsyncRequest(io.netty.channel.Channel channel,
Object msg)
RemotingClientsendAsyncRequest in interface RemotingClientchannel - client channelmsg - transaction message io.seata.core.protocolpublic void sendAsyncResponse(String serverAddress, RpcMessage rpcMessage, Object msg)
RemotingClientsendAsyncResponse in interface RemotingClientserverAddress - server addressrpcMessage - rpc message from server requestmsg - transaction message io.seata.core.protocolpublic void registerProcessor(int requestCode,
RemotingProcessor processor,
ExecutorService executor)
RemotingClientregisterProcessor in interface RemotingClientrequestCode - MessageTypeprocessor - RemotingProcessorexecutor - thread poolpublic void destroyChannel(String serverAddress, io.netty.channel.Channel channel)
AbstractNettyRemotingdestroyChannel in class AbstractNettyRemotingserverAddress - the server addresschannel - the channelpublic void destroy()
destroy in interface Disposabledestroy in class AbstractNettyRemotingpublic void setTransactionMessageHandler(TransactionMessageHandler transactionMessageHandler)
public TransactionMessageHandler getTransactionMessageHandler()
public io.seata.core.rpc.netty.NettyClientChannelManager getClientChannelManager()
protected InetSocketAddress doSelect(List<InetSocketAddress> list, Object msg) throws Exception
Exceptionprotected abstract Function<String,NettyPoolKey> getPoolKeyFunction()
protected abstract String getTransactionServiceGroup()
protected abstract boolean isEnableClientBatchSendRequest()
protected abstract long getRpcRequestTimeout()
Copyright © 2023 Seata. All rights reserved.