public class NettyRemotingServer extends NettyRemotingAbstract implements RemotingServer
defaultRequestProcessor, nettyEventExecuter, processorTable, responseTable, semaphoreAsync, semaphoreOneway| 构造器和说明 |
|---|
NettyRemotingServer(NettyServerConfig nettyServerConfig) |
NettyRemotingServer(NettyServerConfig nettyServerConfig,
ChannelEventListener channelEventListener) |
| 限定符和类型 | 方法和说明 |
|---|---|
ExecutorService |
getCallbackExecutor() |
ChannelEventListener |
getChannelEventListener() |
RPCHook |
getRPCHook() |
void |
invokeAsync(io.netty.channel.Channel channel,
RemotingCommand request,
long timeoutMillis,
InvokeCallback invokeCallback) |
void |
invokeOneway(io.netty.channel.Channel channel,
RemotingCommand request,
long timeoutMillis) |
RemotingCommand |
invokeSync(io.netty.channel.Channel channel,
RemotingCommand request,
long timeoutMillis) |
int |
localListenPort()
服务器绑定的本地端口
PORT
|
void |
registerDefaultProcessor(NettyRequestProcessor processor,
ExecutorService executor) |
void |
registerProcessor(int requestCode,
NettyRequestProcessor processor,
ExecutorService executor)
注册请求处理器,ExecutorService必须要对应一个队列大小有限制的阻塞队列,防止OOM
requestCode
processor
executor
|
void |
registerRPCHook(RPCHook rpcHook) |
void |
shutdown() |
void |
start() |
invokeAsyncImpl, invokeOnewayImpl, invokeSyncImpl, processMessageReceived, processRequestCommand, processResponseCommand, putNettyEvent, scanResponseTablepublic NettyRemotingServer(NettyServerConfig nettyServerConfig)
public NettyRemotingServer(NettyServerConfig nettyServerConfig, ChannelEventListener channelEventListener)
public void start()
start 在接口中 RemotingServicepublic void registerProcessor(int requestCode,
NettyRequestProcessor processor,
ExecutorService executor)
RemotingServerregisterProcessor 在接口中 RemotingServerpublic void registerDefaultProcessor(NettyRequestProcessor processor, ExecutorService executor)
registerDefaultProcessor 在接口中 RemotingServerpublic RemotingCommand invokeSync(io.netty.channel.Channel channel, RemotingCommand request, long timeoutMillis) throws InterruptedException, RemotingSendRequestException, RemotingTimeoutException
public void invokeAsync(io.netty.channel.Channel channel,
RemotingCommand request,
long timeoutMillis,
InvokeCallback invokeCallback)
throws InterruptedException,
RemotingTooMuchRequestException,
RemotingTimeoutException,
RemotingSendRequestException
public void invokeOneway(io.netty.channel.Channel channel,
RemotingCommand request,
long timeoutMillis)
throws InterruptedException,
RemotingTooMuchRequestException,
RemotingTimeoutException,
RemotingSendRequestException
public void shutdown()
shutdown 在接口中 RemotingServicepublic ChannelEventListener getChannelEventListener()
public ExecutorService getCallbackExecutor()
getCallbackExecutor 在类中 NettyRemotingAbstractpublic void registerRPCHook(RPCHook rpcHook)
registerRPCHook 在接口中 RemotingServicepublic RPCHook getRPCHook()
getRPCHook 在类中 NettyRemotingAbstractpublic int localListenPort()
RemotingServerlocalListenPort 在接口中 RemotingServerCopyright © 2018. All rights reserved.