org.apache.felix.eventadmin.impl.dispatch
Interface Scheduler

All Known Implementing Classes:
DelayScheduler

public interface Scheduler

A simple scheduler that accepts a task and schedules its for execution at its own discretion (i.e., the behavior of the actual implementor). The only possible hint is a nice value that should be subtracted from any fixed scheduling interval. Additionally, a null object is provided that can be used to disable scheduled execution.

Author:
Felix Project Team

Field Summary
static Scheduler NULL_SCHEDULER
          This is a null object that can be used in case no scheduling is needed.
 
Method Summary
 void schedule(java.lang.Runnable task)
          Schedule the given task for execution at a later time based on the behavior of the actual implementor of this interface.
 void schedule(java.lang.Runnable task, int nice)
          Schedule the given task for execution at a later time based on the behavior of the actual implementor of this interface.
 

Field Detail

NULL_SCHEDULER

static final Scheduler NULL_SCHEDULER
This is a null object that can be used in case no scheduling is needed. In other words tasks given to this scheduler are never executed.

Method Detail

schedule

void schedule(java.lang.Runnable task)
Schedule the given task for execution at a later time based on the behavior of the actual implementor of this interface. Note that this may mean that the task is never executed.

Parameters:
task - The task to schedule for execution.

schedule

void schedule(java.lang.Runnable task,
              int nice)
Schedule the given task for execution at a later time based on the behavior of the actual implementor of this interface. Note that this may mean that the task is never executed. The nice value should be subtracted from any fixed scheduling interval.

Parameters:
task - The task to schedule for execution.
nice - A value to subtract from any fixed scheduling interval.