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)
must call schedule() later
|
TimedEvent(SimpleTimer2 pool,
long timeoutMs)
automatically schedules, don't use this one if you have other things to do first
|
Modifier and Type | Method and Description |
---|---|
boolean |
cancel() |
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)
|
protected static final int DEFAULT_FUZZ
protected net.i2p.util.SimpleTimer2.TimedEventState _state
public TimedEvent(SimpleTimer2 pool)
public TimedEvent(SimpleTimer2 pool, long timeoutMs)
public void setFuzz(int fuzz)
public void schedule(long timeoutMs)
public void reschedule(long timeoutMs)
timeoutMs
- public void reschedule(long timeoutMs, boolean useEarliestTime)
timeoutMs
- useEarliestTime
- if its already scheduled, use the earlier of the
two timeouts, else use the laterpublic void forceReschedule(long timeoutMs)
timeoutMs
- public boolean cancel()
public abstract void timeReached()