use of com.yanghui.elephant.remoting.RequestProcessor in project elephant by yanghuijava.
the class NettyRemotingAbstract method handlerRequestProcessor.
private void handlerRequestProcessor(final ChannelHandlerContext ctx, final RemotingCommand request, Pair<RequestProcessor, ExecutorService> pair) {
final RequestProcessor requestProcessor = pair.getObject1();
ExecutorService executorService = pair.getObject2();
if (executorService == null) {
RemotingCommand respose = requestProcessor.processRequest(ctx, request);
if (respose != null)
ctx.writeAndFlush(respose);
return;
}
executorService.submit(new Runnable() {
@Override
public void run() {
RemotingCommand respose = requestProcessor.processRequest(ctx, request);
if (respose != null)
ctx.writeAndFlush(respose);
}
});
}
Aggregations