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

The following examples show how to use io.netty.channel.ChannelHandlerContext#flush() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HardwareSyncLogic.java    From blynk-server with GNU General Public License v3.0 6 votes vote down vote up
private static void syncAll(ChannelHandlerContext ctx, int msgId, Profile profile, DashBoard dash, int deviceId) {
    //return all widgets state
    for (Widget widget : dash.widgets) {
        //one exclusion, no need to sync RTC
        if (widget instanceof HardwareSyncWidget && !(widget instanceof RTC) && ctx.channel().isWritable()) {
            ((HardwareSyncWidget) widget).sendHardSync(ctx, msgId, deviceId);
        }
    }

    for (Map.Entry<DashPinStorageKey, PinStorageValue> entry : profile.pinsStorage.entrySet()) {
        DashPinStorageKey key = entry.getKey();
        if (deviceId == key.deviceId
                && dash.id == key.dashId
                && !(key instanceof DashPinPropertyStorageKey)
                && ctx.channel().isWritable()) {
            for (String value : entry.getValue().values()) {
                String body = key.makeHardwareBody(value);
                ctx.write(makeUTF8StringMessage(HARDWARE, msgId, body), ctx.voidPromise());
            }
        }
    }

    ctx.flush();
}
 
Example 2
Source File: FlushingMessageToByteEncoder.java    From pravega with Apache License 2.0 5 votes vote down vote up
@Override
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
    super.write(ctx, msg, promise);
    if (shouldFlush.compareAndSet(true, false)) {
        ctx.flush();
    }
}
 
Example 3
Source File: TelnetServerHandler2.java    From netty.book.kor with MIT License 5 votes vote down vote up
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
	// Send greeting for a new connection.
	ctx.write("환영합니다2. "
				+ InetAddress.getLocalHost().getHostName() + "에 접속하셨습니다!\r\n");
	ctx.write("현재 시간은 " + new Date() + " 입니다2.\r\n");
	ctx.flush();
}
 
Example 4
Source File: HttpConnectionHandler.java    From netty-http2 with Apache License 2.0 4 votes vote down vote up
@Override
public void flush(ChannelHandlerContext ctx) throws Exception {
    ctx.flush();
}
 
Example 5
Source File: ClientHandler.java    From fileserver with Apache License 2.0 4 votes vote down vote up
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
	ctx.flush();
}
 
Example 6
Source File: RakNet.java    From JRakNet with MIT License 4 votes vote down vote up
@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
	ctx.flush();
}
 
Example 7
Source File: SimpleSctpServerHandler.java    From netty-cookbook with Apache License 2.0 4 votes vote down vote up
@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
    ctx.flush();
}
 
Example 8
Source File: Handshaker.java    From Clither-Server with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
    ctx.flush();
}
 
Example 9
Source File: SpdyFrameCodec.java    From netty-4.1.22 with Apache License 2.0 4 votes vote down vote up
@Override
public void flush(ChannelHandlerContext ctx) throws Exception {
    ctx.flush();
}
 
Example 10
Source File: Dhcp6Handler.java    From dhcp4j with Apache License 2.0 4 votes vote down vote up
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
    ctx.flush();
}
 
Example 11
Source File: HeartBeatHandler.java    From netty-cookbook with Apache License 2.0 4 votes vote down vote up
@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
	ctx.flush();
}
 
Example 12
Source File: WsServerHandler.java    From wind-im with Apache License 2.0 4 votes vote down vote up
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
	ctx.flush();
}
 
Example 13
Source File: KeyValueAuthHandler.java    From couchbase-jvm-core with Apache License 2.0 4 votes vote down vote up
@Override
public void flush(ChannelHandlerContext ctx) throws Exception {
    ctx.flush();
}
 
Example 14
Source File: TcpRPCHandler.java    From ns4_frame with Apache License 2.0 4 votes vote down vote up
@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
    ctx.flush();
}
 
Example 15
Source File: ObjectEchoServerHandler.java    From netty4.0.27Learn with Apache License 2.0 4 votes vote down vote up
@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
    ctx.flush();
}
 
Example 16
Source File: HttpServerHandler.java    From Sentinel with Apache License 2.0 4 votes vote down vote up
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
    ctx.flush();
}
 
Example 17
Source File: ServerHandler.java    From appium-uiautomator2-server with Apache License 2.0 4 votes vote down vote up
@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
    ctx.flush();
    ctx.fireChannelReadComplete();
}
 
Example 18
Source File: WebSocketServerHandler.java    From netty-4.1.22 with Apache License 2.0 4 votes vote down vote up
@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
    ctx.flush();
}
 
Example 19
Source File: FallbackRequestHandler.java    From netty-4.1.22 with Apache License 2.0 4 votes vote down vote up
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
    ctx.flush();
}
 
Example 20
Source File: KryonettyClientHandler.java    From kryonetty with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
   ctx.flush();
}