Пример #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);
 }
Пример #2
0
 @Override
 public void channelInactive(ChannelHandlerContext ctx) throws Exception {
   if (byteDecoder != null) {
     byteDecoder.channelInactive(ctx);
     super.channelInactive(ctx);
     byteDecoder = null;
   }
 }
Пример #3
0
 @Override
 public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
   if (needsFlush) {
     needsFlush = false;
     ctx.flush();
   }
   super.channelReadComplete(ctx);
 }
Пример #4
0
 @Override
 public void channelActive(ChannelHandlerContext ctx) throws Exception {
   if (byteDecoder == null) {
     byteDecoder = new PrefaceDecoder(ctx);
   }
   byteDecoder.channelActive(ctx);
   super.channelActive(ctx);
 }
Пример #5
0
 /**
  * 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);
   }
 }
Пример #6
0
 @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);
   }
 }
Пример #7
0
 @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();
 }
Пример #9
0
 @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);
   }
 }
Пример #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);
   }
 }