net.i2p.util
Class SimpleTimer2
java.lang.Object
net.i2p.util.SimpleTimer2
- Direct Known Subclasses:
- RetransmissionTimer
public class SimpleTimer2
- extends Object
Simple event scheduler - toss an event on the queue and it gets fired at the
appropriate time. The method that is fired however should NOT block (otherwise
they b0rk the timer).
This rewrites the old SimpleTimer to use the java.util.concurrent.ScheduledThreadPoolExecutor.
SimpleTimer has problems with lock contention;
this should work a lot better.
This supports cancelling and arbitrary rescheduling.
If you don't need that, use SimpleScheduler instead.
SimpleTimer is deprecated, use this or SimpleScheduler.
- Author:
- zzz
Nested Class Summary |
static class |
SimpleTimer2.TimedEvent
Similar to SimpleTimer.TimedEvent but users must extend instead of implement,
and all schedule and cancel methods are through this class rather than SimpleTimer2. |
SimpleTimer2
protected SimpleTimer2()
SimpleTimer2
protected SimpleTimer2(String name)
getInstance
public static SimpleTimer2 getInstance()
stop
public void stop()
- Removes the SimpleTimer.
toString
public String toString()
- Overrides:
toString
in class Object