public class ParallelTaskManager extends Object
generateUpdateExecuteTask(io.parallec.core.ParallelTask) is the key function to execute a ParallelTask.
It has access to the waiting task queue and the currently running map of ParallelTasks.| Modifier and Type | Method and Description |
|---|---|
void |
addTaskToInProgressMap(String jobId,
ParallelTask task)
when create new job, always add this to the queue.
|
void |
cleanInprogressJobMap()
also clean the waitQ.
|
void |
cleanWaitTaskQueue()
Clean wait task queue.
|
ResponseFromManager |
generateUpdateExecuteTask(ParallelTask task)
key function to execute a parallel task.
|
Map<String,ParallelTask> |
getInprogressTaskMap()
Gets the inprogress task map.
|
static ParallelTaskManager |
getInstance()
Gets the single instance of ParallelTaskManager.
|
int |
getRemainingCapacity()
Gets the remaining capacity.
|
ParallelTask |
getTaskFromInProgressMap(String jobId)
Gets the task from in progress map.
|
int |
getTotalUsedCapacity()
get current total used capacity.
|
Queue<ParallelTask> |
getWaitQ()
Gets the wait q.
|
void |
initTaskSchedulerIfNot()
as it is daemon thread
TODO when release external resources should shutdown the scheduler.
|
void |
removeTaskFromInProgressMap(String jobId)
Removes the task from in progress map.
|
boolean |
removeTaskFromWaitQ(ParallelTask taskTobeRemoved)
Removes the task from wait q.
|
ResponseFromManager |
sendTaskToExecutionManager(ParallelTask task)
Send parallel task to execution manager.
|
void |
shutdownTaskScheduler()
Shutdown task scheduler.
|
public static ParallelTaskManager getInstance()
public void initTaskSchedulerIfNot()
public void shutdownTaskScheduler()
public ParallelTask getTaskFromInProgressMap(String jobId)
jobId - the job idpublic int getTotalUsedCapacity()
public int getRemainingCapacity()
public void addTaskToInProgressMap(String jobId, ParallelTask task)
jobId - the job idtask - the taskpublic void removeTaskFromInProgressMap(String jobId)
jobId - the job idpublic void cleanInprogressJobMap()
public void cleanWaitTaskQueue()
public boolean removeTaskFromWaitQ(ParallelTask taskTobeRemoved)
taskTobeRemoved - the task tobe removedpublic ResponseFromManager generateUpdateExecuteTask(ParallelTask task)
task - the parallel taskpublic Queue<ParallelTask> getWaitQ()
public Map<String,ParallelTask> getInprogressTaskMap()
public ResponseFromManager sendTaskToExecutionManager(ParallelTask task)
task - the parallel taskCopyright © 2015–2017 eBay. All rights reserved.