public abstract static class SimpleTimer2.TimedEvent extends Object implements Runnable
| Modifier and Type | Field and Description |
|---|---|
protected net.i2p.util.SimpleTimer2.TimedEventState | _statestate of the current event. |
protected static int | DEFAULT_FUZZdefault fuzz threshold in milliseconds |
| Modifier | Constructor and Description |
|---|---|
protected | TimedEvent()Create a new timed event without scheduling. |
| TimedEvent(SimpleTimer2 pool)Create a new timed event. |
| TimedEvent(SimpleTimer2 pool,
long timeoutMs)Create a new timed event and automatically schedules it. |
| Modifier and Type | Method and Description |
|---|---|
boolean | cancel()Cancel the timed event. |
void | forceReschedule(long timeoutMs)Always use the new time - ignores fuzz |
void | reschedule(long timeoutMs)Use the earliest of the new time and the old time
May be called from within timeReached(), but schedule() is
better there. |
void | reschedule(long timeoutMs,
boolean useEarliestTime)May be called from within timeReached(), but schedule() is
better there. |
void | run() |
void | schedule(long timeoutMs)Schedule this event. |
void | setFuzz(int fuzz)Set reschedule threshold in ms. |
void | setPool(SimpleTimer2 pool)Set the timer pool. |
abstract void | timeReached()Called when this event's scheduled time arrives. |
String | toString() |
protected net.i2p.util.SimpleTimer2.TimedEventState _state
protected static final int DEFAULT_FUZZ
protected TimedEvent()
public TimedEvent(SimpleTimer2 pool)
pool - the timer poolpublic TimedEvent(SimpleTimer2 pool, long timeoutMs)
pool - the timer pooltimeoutMs - timeout in millisecondspublic boolean cancel()
public void forceReschedule(long timeoutMs)
timeoutMs - timeout in millisecondspublic void reschedule(long timeoutMs)
timeoutMs - timeout in millisecondspublic void reschedule(long timeoutMs,
boolean useEarliestTime)timeoutMs - timeout in millisecondsuseEarliestTime - if true and already scheduled, use the earlier
timeout; if false and already scheduled, use the laterpublic void schedule(long timeoutMs)
timeoutMs - delay in mspublic void setFuzz(int fuzz)
fuzz - the fuzz threshold in mspublic void setPool(SimpleTimer2 pool)
pool - the timer poolpublic abstract void timeReached()