public final class PrioritySerialTaskScheduler extends Object implements TaskScheduler
TaskScheduler that serves tasks for the earliest scheduled
job having the highest priority in a round robin fashion. That is, tasks
are scheduled so that each job completes before the next one starts.| Constructor and Description |
|---|
PrioritySerialTaskScheduler() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(TaskDescription task)
Adds a task to be scheduled.
|
boolean |
contains(UUID jobId,
int taskId)
Determines if the specified task exists.
|
TaskDescription |
get(UUID jobId,
int taskId)
Retrieves the specified task.
|
TaskDescription |
getNextTask()
Gets the next task to be served.
|
TaskDescription |
remove(UUID jobId,
int taskId)
Removes a task from the schedule.
|
void |
removeJob(UUID jobId)
Removes all tasks from the schedule that are associated with the
specified job.
|
void |
setJobPriority(UUID jobId,
int priority)
Sets the priority of a job.
|
public void add(TaskDescription task)
TaskScheduleradd in interface TaskSchedulertask - An TaskDescription describing the task to be
performed.public TaskDescription get(UUID jobId, int taskId)
TaskSchedulerget in interface TaskSchedulerjobId - The UUID identifying the job associated with
the task to retrieve.taskId - The identifier for the task to be retrieved.TaskDescription describing the specified task,
or null if no such task exists.public boolean contains(UUID jobId, int taskId)
TaskSchedulercontains in interface TaskSchedulerjobId - The UUID identifying the job associated with
the task to retrieve.taskId - The identifier for the task to be retrieved.public TaskDescription getNextTask()
TaskSchedulergetNextTask in interface TaskSchedulerTaskDescription describing the next task to be
served.TaskDescriptionpublic TaskDescription remove(UUID jobId, int taskId)
TaskSchedulerremove in interface TaskSchedulerjobId - The UUID identifying the job associated with
the task to be removed.taskId - The identifier for the task to be removed.TaskDescription describing the specified task.public void setJobPriority(UUID jobId, int priority)
TaskSchedulersetJobPriority in interface TaskSchedulerjobId - The UUID identifying the job for which to set
the priority.priority - The priority to set for the specified job.public void removeJob(UUID jobId)
TaskSchedulerremoveJob in interface TaskSchedulerjobId - The UUID identifying the job for which all
tasks are to be removed.Copyright © 2016. All rights reserved.