Skip to content

Instantly share code, notes, and snippets.

@trustin
Created July 3, 2012 12:37
Show Gist options
  • Select an option

  • Save trustin/3039492 to your computer and use it in GitHub Desktop.

Select an option

Save trustin/3039492 to your computer and use it in GitHub Desktop.
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