public abstract static class SimpleTimer2.TimedEvent extends Object implements Runnable
| Modifier and Type | Field and Description |
|---|---|
protected net.i2p.util.SimpleTimer2.TimedEventState |
_state
state of the current event.
|
protected static int |
DEFAULT_FUZZ |
| Constructor and Description |
|---|
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)
Slightly more efficient than reschedule().
|
void |
setFuzz(int fuzz)
Don't bother rescheduling if +/- this many ms or less.
|
abstract void |
timeReached()
Simple interface for events to be queued up and notified on expiration
the time requested has been reached (this call should NOT block,
otherwise the whole SimpleTimer gets backed up)
|
String |
toString()
So the critical "please report" message above isn't so ugly
|
protected net.i2p.util.SimpleTimer2.TimedEventState _state
protected static final int DEFAULT_FUZZ
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 its already scheduled, use the earlier of the
two timeouts, else use the laterpublic void schedule(long timeoutMs)
timeoutMs - the timeout in millisecondspublic void setFuzz(int fuzz)
fuzz - the fuzz value in millisecondspublic abstract void timeReached()