|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.sgs.impl.kernel.TaskSchedulerImpl
final class TaskSchedulerImpl
Package-private implementation of TaskScheduler that is used by
the system scheduling and running all non-transactional, arbitrary-length
tasks. This is an intentionally simple implementation that uses a backing
Executor instead of a SchedulerQueue until there
is better understanding of what (if any) custom scheduling behavior will
help these kinds of tasks.
This class supports the following configuration properties:
"com.sun.sgs.impl.kernel.task.threads"
"4"
| Field Summary | |
|---|---|
static String |
CONSUMER_THREADS_PROPERTY
The property used to define the default number of initial consumer threads. |
static String |
DEFAULT_CONSUMER_THREADS
The default number of initial consumer threads. |
| Constructor Summary | |
|---|---|
TaskSchedulerImpl(Properties properties,
ProfileCollectorHandle profileCollectorHandle)
Creates an instance of TaskSchedulerImpl. |
|
| Method Summary | |
|---|---|
TaskQueue |
createTaskQueue()
Creates a new TaskQueue to use in scheduling dependent tasks. |
TaskReservation |
reserveTask(KernelRunnable task,
Identity owner)
Reserves the ability to run the given task. |
TaskReservation |
reserveTask(KernelRunnable task,
Identity owner,
long startTime)
Reserves the ability to run the given task at a specified point in the future. |
RecurringTaskHandle |
scheduleRecurringTask(KernelRunnable task,
Identity owner,
long startTime,
long period)
Schedules a task to start running at a specified point in the future, and continuing running on a regular period starting from that initial point. |
void |
scheduleTask(KernelRunnable task,
Identity owner)
Schedules a task to run as soon as possible based on the specific scheduler implementation. |
void |
scheduleTask(KernelRunnable task,
Identity owner,
long startTime)
Schedules a task to run at a specified point in the future. |
(package private) void |
setContext(KernelContext kernelContext)
Package-private method used to set the context being used by the kernel. |
(package private) void |
shutdown()
Tells this scheduler to shutdown. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String CONSUMER_THREADS_PROPERTY
public static final String DEFAULT_CONSUMER_THREADS
| Constructor Detail |
|---|
TaskSchedulerImpl(Properties properties,
ProfileCollectorHandle profileCollectorHandle)
throws Exception
TaskSchedulerImpl.
properties - the Properties for the systemprofileCollectorHandle - the ProfileCollectorHandler used to
manage collection of per-task profiling data
Exception - if there is any failure creating the scheduler| Method Detail |
|---|
void setContext(KernelContext kernelContext)
kernelContext - the KernelContext for this scheduler
public TaskReservation reserveTask(KernelRunnable task,
Identity owner)
reserveTask in interface TaskSchedulertask - the KernelRunnable to executeowner - the entity on who's behalf this task is run
TaskReservation for the task
public TaskReservation reserveTask(KernelRunnable task,
Identity owner,
long startTime)
startTime is a value in milliseconds
measured from 1/1/1970.
reserveTask in interface TaskSchedulertask - the KernelRunnable to executeowner - the entity on who's behalf this task is runstartTime - the time at which to start the task
TaskReservation for the task
public void scheduleTask(KernelRunnable task,
Identity owner)
scheduleTask in interface TaskSchedulertask - the KernelRunnable to executeowner - the entity on who's behalf this task is run
public void scheduleTask(KernelRunnable task,
Identity owner,
long startTime)
startTime is a value in milliseconds measured from
1/1/1970. If the starting time has already passed, then the task is
run immediately.
scheduleTask in interface TaskSchedulertask - the KernelRunnable to executeowner - the entity on who's behalf this task is runstartTime - the time at which to start the task
public RecurringTaskHandle scheduleRecurringTask(KernelRunnable task,
Identity owner,
long startTime,
long period)
scheduleTask methods, this
method will never fail to accept to the task so there is no need for
a reservation. Note, however, that the task will not actually start
executing until start is called on the returned
RecurringTaskHandle.
At each execution point the scheduler will make a best effort to run the task, but based on available resources scheduling the task may fail. Regardless, the scheduler will always try again at the next execution time.
scheduleRecurringTask in interface TaskSchedulertask - the KernelRunnable to executeowner - the entity on who's behalf this task is runstartTime - the time at which to start the taskperiod - the length of time in milliseconds between each
recurring task execution
RecurringTaskHandle used to manage the
recurring taskpublic TaskQueue createTaskQueue()
TaskQueue to use in scheduling dependent tasks.
Once a given task has completed the next task will be submitted to the
scheduler to run.
createTaskQueue in interface TaskSchedulerTaskQueuevoid shutdown()
|
RedDwarf, Version 0.10.1 2010-03-14 10:56:12 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||