Example usage for io.netty.channel ChannelHandlerContext fireChannelReadComplete

List of usage examples for io.netty.channel ChannelHandlerContext fireChannelReadComplete

Introduction

In this page you can find the example usage for io.netty.channel ChannelHandlerContext fireChannelReadComplete.

Prototype

@Override
    ChannelHandlerContext fireChannelReadComplete();

Source Link

Usage

From source file:appium.android.server.http.ServerHandler.java

License:Apache License

@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
    ctx.flush();
    ctx.fireChannelReadComplete();
}

From source file:code.google.nfs.rpc.netty.serialize.NettyProtocolDecoder.java

License:Apache License

@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
    if (decodeWasNull) {
        decodeWasNull = false;/*  ww  w  .j  av  a2s. c  om*/
        if (!ctx.channel().config().isAutoRead()) {
            ctx.read();
        }
    }
    ctx.fireChannelReadComplete();
}

From source file:code.google.nfs.rpc.netty.serialize.NettyProtocolDecoder.java

License:Apache License

@Override
public final void handlerRemoved(ChannelHandlerContext ctx) throws Exception {
    ByteBuf buf = internalBuffer();//from ww  w.  java 2  s .  c  om
    int readable = buf.readableBytes();
    if (buf.isReadable()) {
        ByteBuf bytes = buf.readBytes(readable);
        buf.release();
        ctx.fireChannelRead(bytes);
    }
    cumulation = null;
    ctx.fireChannelReadComplete();
    handlerRemoved0(ctx);
}

From source file:com.alibaba.dubbo.remoting.transport.netty4.NettyHandler.java

License:Apache License

@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
    ctx.fireChannelReadComplete();
}

From source file:com.baidu.jprotobuf.pbrpc.transport.handler.RpcClientServiceHandler.java

License:Apache License

@Override
protected void channelRead0(ChannelHandlerContext ctx, RpcDataPackage dataPackage) throws Exception {
    Long correlationId = dataPackage.getRpcMeta().getCorrelationId();
    RpcClientCallState state = rpcClient.removePendingRequest(correlationId);

    Integer errorCode = ErrorCodes.ST_SUCCESS;
    RpcResponseMeta response = dataPackage.getRpcMeta().getResponse();
    if (response != null) {
        errorCode = response.getErrorCode();
    }/*from  w w  w  .  jav  a  2  s  .  c  om*/

    if (!ErrorCodes.isSuccess(errorCode)) {
        if (state != null) {
            state.handleFailure(errorCode, response.getErrorText());
        } else {
            ctx.fireChannelReadComplete();
            throw new Exception(response.getErrorText());
        }
    } else {
        if (state != null) {
            state.setDataPackage(dataPackage);
            state.handleResponse(state.getDataPackage());
        }
    }
    ctx.fireChannelReadComplete();
}

From source file:com.barchart.netty.common.pipeline.MessageFlowHandler.java

License:BSD License

/**
 * Must be called by subclass when the flow completes. The simplest way to
 * do this is usually by using the OnComplete() state listener in your Flow.
 *
 * @see OnComplete//from   w  w  w  .j  ava 2  s  . co  m
 */
protected void complete(final ChannelHandlerContext ctx) throws Exception {

    log.debug("Flow complete, flushing inbound message queue");

    // Notify downstream that connection is active
    if (blockActivate) {
        super.channelActive(ctx);
    }

    Object msg;
    for (;;) {
        msg = inboundQueue.poll();
        if (msg == null) {
            break;
        }
        ctx.fireChannelRead(msg);
    }

    ctx.fireChannelReadComplete();

    ctx.pipeline().remove(this);

}

From source file:com.linecorp.armeria.internal.FlushConsolidationHandler.java

License:Apache License

@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
    // This may be the last event in the read loop, so flush now!
    flushIfNeeded(ctx, true);/*from  w  w w.j  a  v  a  2  s .co m*/
    ctx.fireChannelReadComplete();
}

From source file:com.sample.netty.socket.server.ServerHandlerInbound.java

@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
    LOG.trace("[SERVER] processa mensagem ->" + ctx.fireChannelReadComplete().name());
}

From source file:divconq.net.ByteToMessageDecoder.java

License:Apache License

@Override
public final void handlerRemoved(ChannelHandlerContext ctx) throws Exception {
    ByteBuf buf = internalBuffer();/*www. ja  v a  2  s.  c  o m*/
    int readable = buf.readableBytes();
    if (buf.isReadable()) {
        ByteBuf bytes = buf.readBytes(readable);
        buf.release();
        ctx.fireChannelRead(bytes);
    } else {
        buf.release();
    }
    this.cumulation = null;
    ctx.fireChannelReadComplete();
    this.handlerRemoved0(ctx);
}

From source file:divconq.net.ByteToMessageDecoder.java

License:Apache License

@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
    if (this.cumulation != null && !this.first && this.cumulation.refCnt() == 1) {
        // discard some bytes if possible to make more room in the
        // buffer but only if the refCnt == 1  as otherwise the user may have
        // used slice().retain() or duplicate().retain().
        ///*  w  w  w .  j  a  va2s . co  m*/
        // See:
        // - https://github.com/netty/netty/issues/2327
        // - https://github.com/netty/netty/issues/1764
        this.cumulation.discardSomeReadBytes();
    }
    if (this.decodeWasNull) {
        this.decodeWasNull = false;

        if (ctx.channel().config().isAutoRead()) {
            ctx.read();
        }
    }
    ctx.fireChannelReadComplete();
}