Skip to content

Instantly share code, notes, and snippets.

@darionyaphet
Created June 27, 2014 08:37
Show Gist options
  • Save darionyaphet/5eb51cbcff147b0ff57a to your computer and use it in GitHub Desktop.
Save darionyaphet/5eb51cbcff147b0ff57a to your computer and use it in GitHub Desktop.
Netty HashedWheelTimerExamples.java
package netty.examples;
import java.util.concurrent.TimeUnit;
import io.netty.util.HashedWheelTimer;
import io.netty.util.Timeout;
import io.netty.util.Timer;
import io.netty.util.TimerTask;
public class HashedWheelTimerExamples {
public static void main(String[] args) {
Timer timer = new HashedWheelTimer();
timer.newTimeout(new TimerTask() {
@Override
public void run(Timeout arg0) throws Exception {
System.out.println("timeout after 3 senconds");
}
}, 3, TimeUnit.SECONDS);
timer.newTimeout(new TimerTask() {
@Override
public void run(Timeout arg0) throws Exception {
System.out.println("timeout after 5 senconds");
}
}, 5, TimeUnit.SECONDS);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment