Created
July 3, 2012 12:37
-
-
Save trustin/3039492 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| public class MyHandler extends ChannelOutboundMessageHandlerAdapter { | |
| ... | |
| public void flush(ChannelHandlerContext ctx, ChannelFuture f) { | |
| ... | |
| ctx.flush(f); | |
| // Schedule a write timeout. | |
| ctx.executor().schedule(new MyWriteTimeoutTask(), 30, TimeUnit.SECONDS); | |
| ... | |
| } | |
| } | |
| public class Main { | |
| public static void main(String[] args) throws Exception { | |
| // Run an arbitrary task from an I/O thread. | |
| Channel ch = ...; | |
| ch.executor().execute(new Runnable() { ... }); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment