Example #1
0
 @Override
 public void channelInactive(ChannelHandlerContext ctx) throws Exception {
   // Make sure to release SSLEngine,
   // and notify the handshake future if the connection has been closed during handshake.
   setHandshakeFailure(ctx, CHANNEL_CLOSED);
   super.channelInactive(ctx);
 }
 @Override
 public void channelInactive(ChannelHandlerContext ctx) throws Exception {
   if (byteDecoder != null) {
     byteDecoder.channelInactive(ctx);
     super.channelInactive(ctx);
     byteDecoder = null;
   }
 }
Example #3
0
 @Override
 public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
   if (needsFlush) {
     needsFlush = false;
     ctx.flush();
   }
   super.channelReadComplete(ctx);
 }
 @Override
 public void channelActive(ChannelHandlerContext ctx) throws Exception {
   if (byteDecoder == null) {
     byteDecoder = new PrefaceDecoder(ctx);
   }
   byteDecoder.channelActive(ctx);
   super.channelActive(ctx);
 }
 /**
  * Handles {@link Http2Exception} objects that were thrown from other handlers. Ignores all other
  * exceptions.
  */
 @Override
 public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
   if (getEmbeddedHttp2Exception(cause) != null) {
     // Some exception in the causality chain is an Http2Exception - handle it.
     onException(ctx, cause);
   } else {
     super.exceptionCaught(ctx, cause);
   }
 }
 @Override
 public void flush(ChannelHandlerContext ctx) throws Http2Exception {
   // Trigger pending writes in the remote flow controller.
   connection().remote().flowController().writePendingBytes();
   try {
     super.flush(ctx);
   } catch (Throwable t) {
     throw new Http2Exception(INTERNAL_ERROR, "Error flushing", t);
   }
 }
 @Override
 public void channelInactive(ChannelHandlerContext ctx) throws Exception {
   if (byteDecoder != null) {
     encoder.flowController().channelHandlerContext(null);
     decoder.flowController().channelHandlerContext(null);
     byteDecoder.channelInactive(ctx);
     super.channelInactive(ctx);
     byteDecoder = null;
   }
 }
 @Override
 public void channelActive(ChannelHandlerContext ctx) throws Exception {
   super.channelActive(ctx);
   connection =
       ProtonServerConnectionContextFactory.getFactory()
           .createConnection(
               new MinimalConnectionSPI(ctx.channel()),
               Executors.newSingleThreadExecutor(ActiveMQThreadFactory.defaultThreadFactory()),
               null);
   // ctx.read();
 }
 @Override
 public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
   // Trigger flush after read on the assumption that flush is cheap if there is nothing to write
   // and that
   // for flow-control the read may release window that causes data to be written that can now be
   // flushed.
   try {
     flush(ctx);
   } finally {
     super.channelReadComplete(ctx);
   }
 }
Example #10
0
 @Override
 public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception {
   // Writability is expected to change while we are writing. We cannot allow this event to trigger
   // reentering
   // the allocation and write loop. Reentering the event loop will lead to over or illegal
   // allocation.
   try {
     if (ctx.channel().isWritable()) {
       flush(ctx);
     }
   } finally {
     super.channelWritabilityChanged(ctx);
   }
 }