org.apache.felix.eventadmin.impl.dispatch
Class DelayScheduler
java.lang.Object
org.apache.felix.eventadmin.impl.dispatch.DelayScheduler
- All Implemented Interfaces:
- Scheduler
public class DelayScheduler
- extends java.lang.Object
- implements Scheduler
A simple delay scheduler that schedules tasks based on a fixed delay. Possible
nice values are subtracted from this delay where appropriate. Note that this
class uses a java.util.Timer internally that is set to be a daemon hence,
allows to shutdown the vm regardless but can not be stopped. The spec says that
a java.util.Timer without a reference to itself should go away eventually
but no guaranties are given. It follows that once the bundle is stopped all
references to instances of this class should be released and this in turn will
allow that the timer thread goes away eventually, but this may take an arbitrary
amount of time.
- Author:
- Felix Project Team
- See Also:
Scheduler
,
Timer
Constructor Summary |
DelayScheduler(int delay)
The constructor of the scheduler. |
Method Summary |
void |
schedule(java.lang.Runnable task)
Schedule the task to execute after the given delay. |
void |
schedule(java.lang.Runnable task,
int nice)
Schedule the task to execute after the given delay minus the nice. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DelayScheduler
public DelayScheduler(int delay)
- The constructor of the scheduler. The scheduler will use the given delay to
schedule tasks accordingly.
- Parameters:
delay
- The delay in milliseconds before a task is executed
schedule
public void schedule(java.lang.Runnable task)
- Schedule the task to execute after the given delay.
- Specified by:
schedule
in interface Scheduler
- Parameters:
task
- The task to schedule for execution.- See Also:
Scheduler.schedule(java.lang.Runnable)
schedule
public void schedule(java.lang.Runnable task,
int nice)
- Schedule the task to execute after the given delay minus the nice.
- Specified by:
schedule
in interface Scheduler
- Parameters:
task
- The task to schedule for execution after delay minus nicenice
- The time to subtract from the delay.- See Also:
Scheduler.schedule(java.lang.Runnable, int)