net.i2p.util
Class SimpleTimer2

java.lang.Object
  extended by net.i2p.util.SimpleTimer2
Direct Known Subclasses:
RetransmissionTimer

public class SimpleTimer2
extends java.lang.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.
 
Constructor Summary
protected SimpleTimer2()
           
protected SimpleTimer2(java.lang.String name)
           
 
Method Summary
static SimpleTimer2 getInstance()
           
 void stop()
          Removes the SimpleTimer.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleTimer2

protected SimpleTimer2()

SimpleTimer2

protected SimpleTimer2(java.lang.String name)
Method Detail

getInstance

public static SimpleTimer2 getInstance()

stop

public void stop()
Removes the SimpleTimer.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object