@Override public void channelReadComplete(ChannelHandlerContext ctx) throws Exception { if (inboundEmitter.requested != 0L) { ctx.read(); } else { if (log.isDebugEnabled()) { log.debug("Pausing read due to lack of request"); } } ctx.fireChannelReadComplete(); }
@Override public void channelReadComplete(ChannelHandlerContext ctx) throws Exception { if (isRemote(ctx)) { byte[] data = getPayloadFromByteBuf(buffer); LOG.trace( "Read complete,send message to remote channel: " + routeId + ",message is " + new String(data)); broker.sendRequest(new UscRemoteDataMessage(routeId, data, true)); buffer.clear(); return; } // propagate the data to rest of handlers in pipeline ctx.fireChannelReadComplete(); }
@Override public void channelReadComplete(ChannelHandlerContext ctx) throws Exception { // Discard bytes of the cumulation buffer if needed. discardSomeReadBytes(); if (needsFlush) { needsFlush = false; ctx.flush(); } // If handshake is not finished yet, we need more data. if (!ctx.channel().config().isAutoRead() && (!firedChannelRead || !handshakePromise.isDone())) { // No auto-read used and no message passed through the ChannelPipeline or the handhshake was // not complete // yet, which means we need to trigger the read to ensure we not encounter any stalls. ctx.read(); } firedChannelRead = false; ctx.fireChannelReadComplete(); }
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) { if (msg instanceof HttpResponse) { this.responseContext = new HttpResponseContext(); this.responseInformationProcessor = new HttpResponseInformationProcessor(); this.responseAssertProcessor = new HttpResponseAssertProcessor(); HttpResponse response = (HttpResponse) msg; responseInformationProcessor.process(response, responseContext); } if (msg instanceof HttpContent) { HttpContent httpContent = (HttpContent) msg; ByteBuf content = httpContent.content(); if (content.isReadable()) { this.responseInformationProcessor.appendDecoderResult( responseContext, httpContent, content); } if (content instanceof LastHttpContent) { ctx.fireChannelReadComplete(); } } }
@Override public void channelReadComplete(ChannelHandlerContext ctx) throws Exception { System.out.println("channel 读取完毕"); ctx.fireChannelReadComplete(); }