public class NettyRemotingServer extends NettyRemotingAbstract implements RemotingServer
defaultRequestProcessor, nettyEventExecutor, processorTable, responseTable, semaphoreAsync, semaphoreOneway
Constructor and Description |
---|
NettyRemotingServer(NettyServerConfig nettyServerConfig) |
NettyRemotingServer(NettyServerConfig nettyServerConfig,
ChannelEventListener channelEventListener) |
Modifier and Type | Method and Description |
---|---|
ExecutorService |
getCallbackExecutor() |
ChannelEventListener |
getChannelEventListener() |
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)
同步调用
|
void |
registerDefaultProcessor(NettyRequestProcessor processor,
ExecutorService executor)
注册默认请求处理器
|
void |
registerProcessor(int requestCode,
NettyRequestProcessor processor,
ExecutorService executor)
注册请求处理器,ExecutorService必须要对应一个队列大小有限制的阻塞队列,防止OOM
|
void |
shutdown() |
void |
start() |
invokeAsyncImpl, invokeOnewayImpl, invokeSyncImpl, processMessageReceived, processRequestCommand, processResponseCommand, putNettyEvent, scanResponseTable
public NettyRemotingServer(NettyServerConfig nettyServerConfig)
public NettyRemotingServer(NettyServerConfig nettyServerConfig, ChannelEventListener channelEventListener)
public void start() throws InterruptedException
start
in interface RemotingServer
InterruptedException
public void registerProcessor(int requestCode, NettyRequestProcessor processor, ExecutorService executor)
RemotingServer
registerProcessor
in interface RemotingServer
public void registerDefaultProcessor(NettyRequestProcessor processor, ExecutorService executor)
RemotingServer
registerDefaultProcessor
in interface RemotingServer
public RemotingCommand invokeSync(io.netty.channel.Channel channel, RemotingCommand request, long timeoutMillis) throws InterruptedException, RemotingSendRequestException, RemotingTimeoutException
RemotingServer
invokeSync
in interface RemotingServer
InterruptedException
RemotingSendRequestException
RemotingTimeoutException
public void invokeAsync(io.netty.channel.Channel channel, RemotingCommand request, long timeoutMillis, InvokeCallback invokeCallback) throws InterruptedException, RemotingTooMuchRequestException, RemotingTimeoutException, RemotingSendRequestException
RemotingServer
invokeAsync
in interface RemotingServer
InterruptedException
RemotingTooMuchRequestException
RemotingTimeoutException
RemotingSendRequestException
public void invokeOneway(io.netty.channel.Channel channel, RemotingCommand request, long timeoutMillis) throws InterruptedException, RemotingTooMuchRequestException, RemotingTimeoutException, RemotingSendRequestException
RemotingServer
invokeOneway
in interface RemotingServer
InterruptedException
RemotingTooMuchRequestException
RemotingTimeoutException
RemotingSendRequestException
public void shutdown()
shutdown
in interface RemotingServer
public ChannelEventListener getChannelEventListener()
getChannelEventListener
in class NettyRemotingAbstract
public ExecutorService getCallbackExecutor()
getCallbackExecutor
in class NettyRemotingAbstract
Copyright © 2014. All Rights Reserved.