public class SimpleTimer2 extends Object
| Modifier and Type | Class and Description |
|---|---|
static class | SimpleTimer2.TimedEventBase class for timer events. |
| Modifier | Constructor and Description |
|---|---|
| SimpleTimer2(I2PAppContext context)To be instantiated by the context. |
| SimpleTimer2(I2PAppContext context,
String name)To be instantiated by the context. |
protected | SimpleTimer2(I2PAppContext context,
String name,
boolean prestartAllThreads)To be instantiated by the context. |
| Modifier and Type | Method and Description |
|---|---|
void | addEvent(SimpleTimer2.TimedEvent event,
long timeoutMs)Queue up the given event to be fired no sooner than timeoutMs from now. |
void | addPeriodicEvent(SimpleTimer2.TimedEvent event,
long timeoutMs)Schedule a periodic event backed by SimpleTimer2.TimedEvent. |
void | addPeriodicEvent(SimpleTimer2.TimedEvent event,
long delay,
long timeoutMs)Schedule a periodic event backed by SimpleTimer2.TimedEvent. |
static SimpleTimer2 | getInstance()If you have a context, use context.simpleTimer2() instead |
void | stop()Stops the timer. |
String | toString() |
public SimpleTimer2(I2PAppContext context)
context - the I2P application contextpublic SimpleTimer2(I2PAppContext context, String name)
context - the I2P application contextname - the timer name, used for the timer thread nameprotected SimpleTimer2(I2PAppContext context, String name, boolean prestartAllThreads)
context - the I2P application contextname - the timer nameprestartAllThreads - whether to prestart all threadspublic void addEvent(SimpleTimer2.TimedEvent event, long timeoutMs)
event - to be run oncetimeoutMs - run after this delaypublic void addPeriodicEvent(SimpleTimer2.TimedEvent event, long timeoutMs)
event - the eventtimeoutMs - period in ms between executionsIllegalArgumentException - if timeoutMs less than 5000public void addPeriodicEvent(SimpleTimer2.TimedEvent event, long delay, long timeoutMs)
event - the eventdelay - run the first iteration after delay mstimeoutMs - period in ms between executionsIllegalArgumentException - if timeoutMs less than 5000public static SimpleTimer2 getInstance()
public void stop()