Package net.i2p.util
Class SimpleTimer
java.lang.Object
net.i2p.util.SimpleTimer
public class SimpleTimer extends 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).
WARNING - Deprecated.
This is an inefficient mess. Use SimpleTimer2 if possible.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceSimpleTimer.TimedEventSimple interface for events to be queued up and notified on expiration -
Constructor Summary
Constructors Constructor Description SimpleTimer(I2PAppContext context)Deprecated.use SimpleTimer2 -
Method Summary
Modifier and Type Method Description voidaddEvent(SimpleTimer.TimedEvent event, long timeoutMs)Queue up the given event to be fired no sooner than timeoutMs from now.voidaddEvent(SimpleTimer.TimedEvent event, long timeoutMs, boolean useEarliestTime)static SimpleTimergetInstance()Deprecated.use SimpleTimer2booleanremoveEvent(SimpleTimer.TimedEvent evt)voidremoveSimpleTimer()Removes the SimpleTimer.voidreschedule(SimpleTimer.TimedEvent event, long timeoutMs)
-
Constructor Details
-
SimpleTimer
Deprecated.use SimpleTimer2To be instantiated by the context. Others should use context.simpleTimer() instead
-
-
Method Details
-
getInstance
Deprecated.use SimpleTimer2If you have a context, use context.simpleTimer() instead -
removeSimpleTimer
public void removeSimpleTimer()Removes the SimpleTimer. -
reschedule
- Parameters:
event-timeoutMs-
-
addEvent
Queue up the given event to be fired no sooner than timeoutMs from now. However, if this event is already scheduled, the event will be scheduled for the earlier of the two timeouts, which may be before this stated timeout. If this is not the desired behavior, call removeEvent first.- Parameters:
event-timeoutMs-
-
addEvent
- Parameters:
event-timeoutMs-useEarliestTime- if its already scheduled, use the earlier of the two timeouts, else use the later
-
removeEvent
-