Package net.i2p.util
Class SimpleScheduler
java.lang.Object
net.i2p.util.SimpleScheduler
Deprecated.
in 0.9.20, use SimpleTimer2 instead
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).
This is like SimpleTimer but addEvent() for an existing event adds a second
job. Unlike SimpleTimer, events cannot be cancelled or rescheduled.
For events that cannot or will not be cancelled or rescheduled -
for example, a call such as:
SimpleTimer.getInstance().addEvent(new FooEvent(bar), timeoutMs);
use SimpleScheduler instead to reduce lock contention in SimpleTimer...
For periodic events, use addPeriodicEvent(). Unlike SimpleTimer,
uncaught Exceptions will not prevent subsequent executions.
- Author:
- zzz
-
Constructor Summary
ConstructorDescriptionSimpleScheduler
(I2PAppContext context) Deprecated.in 0.9.20, replaced by SimpleTimer2 -
Method Summary
Modifier and TypeMethodDescriptionvoid
addEvent
(SimpleTimer.TimedEvent event, long timeoutMs) Deprecated.Queue up the given event to be fired no sooner than timeoutMs from now.void
addPeriodicEvent
(SimpleTimer.TimedEvent event, long timeoutMs) Deprecated.Queue up the given event to be fired after timeoutMs and every timeoutMs thereafter.void
addPeriodicEvent
(SimpleTimer.TimedEvent event, long initialDelay, long timeoutMs) Deprecated.Queue up the given event to be fired after initialDelay and every timeoutMs thereafter.static SimpleScheduler
Deprecated.in 0.9.20, replaced by SimpleTimer2void
stop()
Deprecated.Stops the SimpleScheduler.
-
Constructor Details
-
SimpleScheduler
Deprecated.in 0.9.20, replaced by SimpleTimer2To be instantiated by the context. Others should use context.simpleTimer() instead
-
-
Method Details
-
getInstance
Deprecated.in 0.9.20, replaced by SimpleTimer2If you have a context, use context.simpleScheduler() instead -
stop
public void stop()Deprecated.Stops the SimpleScheduler. Subsequent executions should not throw a RejectedExecutionException. -
addEvent
Deprecated.Queue up the given event to be fired no sooner than timeoutMs from now.- Parameters:
event
-timeoutMs
-
-
addPeriodicEvent
Deprecated.Queue up the given event to be fired after timeoutMs and every timeoutMs thereafter. The TimedEvent must not do its own rescheduling. As all Exceptions are caught in run(), these will not prevent subsequent executions (unlike SimpleTimer, where the TimedEvent does its own rescheduling). -
addPeriodicEvent
Deprecated.Queue up the given event to be fired after initialDelay and every timeoutMs thereafter. The TimedEvent must not do its own rescheduling. As all Exceptions are caught in run(), these will not prevent subsequent executions (unlike SimpleTimer, where the TimedEvent does its own rescheduling)- Parameters:
event
-initialDelay
- (ms)timeoutMs
-
-