Example usage for io.netty.channel ChannelHandlerContext flush

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

Introduction

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

Prototype

@Override
    ChannelHandlerContext flush();

Source Link

Usage

From source file:WorldClockServerHandler.java

License:Apache License

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

From source file:IncommingPacketHandler.java

License:Open Source License

@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
    System.out.println("Channel Read Complete");
    ctx.flush();
}

From source file:app.WebSocketServerHandler.java

License:Apache License

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

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:bftsmart.communication.client.netty.NettyTOMMessageEncoder.java

License:Apache License

@Override
protected void encode(ChannelHandlerContext context, TOMMessage sm, ByteBuf buffer) throws Exception {
    byte[] msgData;
    byte[] signatureData = null;

    msgData = sm.serializedMessage;/*from  w w w  .j  a  va2 s  .co m*/
    if (sm.signed) {
        //signature was already produced before            
        signatureData = sm.serializedMessageSignature;
    }

    int dataLength = Integer.BYTES + msgData.length + Integer.BYTES
            + (signatureData != null ? signatureData.length : 0);

    /* msg size */
    buffer.writeInt(dataLength);

    /* data to be sent */
    buffer.writeInt(msgData.length);
    buffer.writeBytes(msgData);

    /* signature */
    if (signatureData != null) {
        buffer.writeInt(signatureData.length);
        buffer.writeBytes(signatureData);
    } else {
        buffer.writeInt(0);
    }

    context.flush();
}

From source file:books.netty.codec.marshalling.SubReqClientHandler.java

License:Apache License

@Override
public void channelActive(ChannelHandlerContext ctx) {
    for (int i = 0; i < 10; i++) {
        ctx.write(subReq(i));/*from  ww  w. ja  v a2  s  .  com*/
    }
    ctx.flush();
}

From source file:ch.ethz.globis.distindex.middleware.net.MiddlewareChannelHandler.java

License:Open Source License

@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
    ByteBuf buf = (ByteBuf) msg;/*w  ww  .j  a v a 2 s  .com*/
    String clientHost = ctx.channel().remoteAddress().toString();
    ByteBuffer response = ioHandler.handle(clientHost, buf.nioBuffer());
    ByteBuf nettyBuf = Unpooled.wrappedBuffer(response);
    ByteBuf sizeBuf = Unpooled.copyInt(nettyBuf.readableBytes());

    ctx.write(sizeBuf);
    ctx.write(nettyBuf);
    ctx.flush();
    buf.release();
}

From source file:co.paralleluniverse.comsat.webactors.netty.WebActorHandler.java

License:Open Source License

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

From source file:com.addthis.hydra.query.web.AbstractBufferingHttpBundleEncoder.java

License:Apache License

@Override
public void flush(ChannelHandlerContext ctx) {
    if (sendBuffer.length() > 0) {
        flushStringBuilder(ctx);/*from ww w.  ja  v  a  2  s.c om*/
    } else {
        ctx.flush();
    }
}

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

License:Apache License

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