Last active
August 29, 2015 13:56
-
-
Save daschl/9205337 to your computer and use it in GitHub Desktop.
Flush me maybe!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Helper method to flush the pipeline if possible. | |
* | |
* Hey, I just connected you, | |
* And this is crazy, | |
* But here's my data, | |
* So flush me maybe! | |
* It's hard to read right, | |
* From your channel, | |
* But here's my data, | |
* So flush me maybe! | |
* | |
* @param ctx the channel handler context. | |
*/ | |
private static void flushMeMaybe(final ChannelHandlerContext ctx) { | |
Channel channel = ctx.channel(); | |
if (channel.isWritable() && channel.isActive()) { | |
ctx.flush(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment