예제 #1
0
 @Override
 protected void channelRead(
     final C connection,
     final ContextImpl context,
     final ChannelHandlerContext chctx,
     final Object msg)
     throws Exception {
   if (msg instanceof HttpObject) {
     DecoderResult result = ((HttpObject) msg).getDecoderResult();
     if (result.isFailure()) {
       chctx.pipeline().fireExceptionCaught(result.cause());
       return;
     }
   }
   if (connection != null) {
     // we are reading from the channel
     // We need to do this since it's possible the server is being used from a worker context
     context.execute(() -> doMessageReceived(connection, chctx, msg), true);
   } else {
     // We execute this directly as we don't have a context yet, the context will have to be set
     // manually
     // inside doMessageReceived();
     try {
       doMessageReceived(null, chctx, msg);
     } catch (Throwable t) {
       chctx.pipeline().fireExceptionCaught(t);
     }
   }
 }
 @Override
 public void operationComplete(final ChannelFuture future) throws Exception {
   context.execute(() -> notifyHandler(future), true);
 }
예제 #3
0
 /** Run the blocking action using a thread from the worker pool. */
 public void run() {
   context.executeBlocking(this, handler);
 }