Created
June 27, 2014 08:37
-
-
Save darionyaphet/5eb51cbcff147b0ff57a to your computer and use it in GitHub Desktop.
Netty HashedWheelTimerExamples.java
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
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