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() |
Pair<NettyRequestProcessor,ExecutorService> |
getProcessorPair(int requestCode) |
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()
服务器绑定的本地端口
|
void |
registerDefaultProcessor(NettyRequestProcessor processor,
ExecutorService executor) |
void |
registerProcessor(int requestCode,
NettyRequestProcessor processor,
ExecutorService executor)
注册请求处理器,ExecutorService必须要对应一个队列大小有限制的阻塞队列,防止OOM
|
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 shutdown()
shutdown 在接口中 RemotingServicepublic void registerRPCHook(RPCHook rpcHook)
registerRPCHook 在接口中 RemotingServicepublic void registerProcessor(int requestCode,
NettyRequestProcessor processor,
ExecutorService executor)
RemotingServerregisterProcessor 在接口中 RemotingServerpublic void registerDefaultProcessor(NettyRequestProcessor processor, ExecutorService executor)
registerDefaultProcessor 在接口中 RemotingServerpublic int localListenPort()
RemotingServerlocalListenPort 在接口中 RemotingServerpublic Pair<NettyRequestProcessor,ExecutorService> getProcessorPair(int requestCode)
getProcessorPair 在接口中 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 ChannelEventListener getChannelEventListener()
public RPCHook getRPCHook()
getRPCHook 在类中 NettyRemotingAbstractpublic ExecutorService getCallbackExecutor()
getCallbackExecutor 在类中 NettyRemotingAbstractCopyright © 2012–2016. All rights reserved.