Java Code Examples for io.netty.channel.ChannelHandlerContext.flush()

The following are Jave code examples for showing how to use flush() of the io.netty.channel.ChannelHandlerContext class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: neoscada   File: MessageChannel.java   View Source Code Vote up 6 votes
private void processInformationTransfer ( final ChannelHandlerContext ctx, final Object msg )
{
    final List<Object> out = new LinkedList<> ();

    logger.trace ( "Passing to manager: {}", msg );
    final ByteBuf errorData = this.manager.receiveMessage ( (InformationTransfer)msg, out );
    if ( errorData != null )
    {
        logger.debug ( "Write error reply" );
        writeMessageToChannel ( ctx, errorData, null );
        ctx.flush ();
    }

    for ( final Object newMsg : out )
    {
        logger.trace ( "Passing message: {}", newMsg );
        ctx.fireChannelRead ( newMsg );
    }
}
 
Example 2
Project: neoscada   File: MessageChannel.java   View Source Code Vote up 5 votes
protected synchronized void handleAck ( final ChannelHandlerContext ctx, final int receiveSequenceNumber )
{
    logger.trace ( "Received ACK up to: {}", receiveSequenceNumber );

    // handle ack
    this.ackBuffer.gotAck ( receiveSequenceNumber );

    // now try to flush messages from the buffer
    sendFromBuffer ();
    // try to send from sources
    sendFromSources ();

    ctx.flush ();
}
 
Example 3
Project: chromium-net-for-android   File: Http2TestHandler.java   View Source Code Vote up 5 votes
int onDataRead(ChannelHandlerContext ctx, int streamId, ByteBuf data, int padding,
        boolean endOfStream) {
    int processed = data.readableBytes() + padding;
    encoder().writeData(ctx, streamId, data.retain(), 0, true, ctx.newPromise());
    ctx.flush();
    return processed;
}
 
Example 4
Project: chromium-net-for-android   File: Http2TestHandler.java   View Source Code Vote up 5 votes
@Override
void onHeadersRead(ChannelHandlerContext ctx, int streamId, boolean endOfStream,
        Http2Headers headers) {
    encoder().writeHeaders(
            ctx, streamId, createDefaultResponseHeaders(), 0, false, ctx.newPromise());
    encoder().writeData(
            ctx, streamId, RESPONSE_BYTES.duplicate(), 0, false, ctx.newPromise());
    Http2Headers responseTrailers = createResponseHeadersFromRequestHeaders(headers).add(
            "trailer", "value1", "Value2");
    encoder().writeHeaders(ctx, streamId, responseTrailers, 0, true, ctx.newPromise());
    ctx.flush();
}
 
Example 5
Project: tools   File: TransmissionPhase.java   View Source Code Vote up 5 votes
private void sendTransmissionSimpleReply(ChannelHandlerContext ctx, int error, long handle, ByteBuf data) {
    synchronized (this) {
        ByteBuf bbr = ctx.alloc().buffer(16);
        bbr.writeInt(Protocol.REPLY_MAGIC);
        bbr.writeInt(error); // zero for okay
        bbr.writeLong(handle);
        ctx.write(bbr);
        if (data != null) {
            ctx.write(data);
        }
    }
    ctx.flush();
    logPendingOperations();
}
 
Example 6
Project: nitmproxy   File: TlsHandler.java   View Source Code Vote up 5 votes
@Override
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
    synchronized (pendings) {
        pendings.add(msg);
    }
    if (ctx.isRemoved()) {
        flushPendings(ctx);
        ctx.flush();
    }
}
 
Example 7
Project: chromium-net-for-android   File: Http2TestHandler.java   View Source Code Vote up 5 votes
void sendResponseString(ChannelHandlerContext ctx, int streamId, String responseString) {
    ByteBuf content = ctx.alloc().buffer();
    ByteBufUtil.writeAscii(content, responseString);
    encoder().writeHeaders(
            ctx, streamId, createDefaultResponseHeaders(), 0, false, ctx.newPromise());
    encoder().writeData(ctx, streamId, content, 0, true, ctx.newPromise());
    ctx.flush();
}
 
Example 8
Project: iotplatform   File: MqttTransportHandler.java   View Source Code Vote up 4 votes
@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
  ctx.flush();
}
 
Example 9
Project: wecard-server   File: NettyServerHandler.java   View Source Code Vote up 4 votes
@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
    ctx.flush();
}
 
Example 10
Project: hadoop   File: HdfsWriter.java   View Source Code Vote up 4 votes
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
  ctx.flush();
}
 
Example 11
Project: netto_rpc   File: NettyNettoMessageHandler.java   View Source Code Vote up 4 votes
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
	ctx.flush();
}
 
Example 12
Project: FFS-PubSub   File: WebSocketHandler.java   View Source Code Vote up 4 votes
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
    ctx.flush();
}
 
Example 13
Project: iothub   File: MqttTransportHandler.java   View Source Code Vote up 4 votes
@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
  ctx.flush();
}
 
Example 14
Project: mqttserver   File: MqttMessageHandler.java   View Source Code Vote up 4 votes
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
	ctx.flush();
}
 
Example 15
Project: NSS   File: SocksServerHandler.java   View Source Code Vote up 4 votes
@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
	ctx.flush();
}
 
Example 16
Project: karate   File: FeatureServerHandler.java   View Source Code Vote up 4 votes
@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
    ctx.flush();
}
 
Example 17
Project: teslog   File: HttpHelloWorldServerHandler.java   View Source Code Vote up 4 votes
@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
    ctx.flush();
}
 
Example 18
Project: ss-java   File: SocksServerHandler.java   View Source Code Vote up 4 votes
@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
    ctx.flush();
}
 
Example 19
Project: hadoop   File: FSImageHandler.java   View Source Code Vote up 4 votes
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
  ctx.flush();
}
 
Example 20
Project: iot-platform   File: MqttInBoundHandler.java   View Source Code Vote up 4 votes
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
    ctx.flush();
}