@ThreadSafe
public class TaskExecutorManager
extends java.lang.Object
| Constructor and Description |
|---|
TaskExecutorManager(int taskExecutorPoolSize,
WorkerNetAddress address)
Constructs a new instance of
TaskExecutorManager. |
| Modifier and Type | Method and Description |
|---|---|
void |
cancelTask(long jobId,
long taskId)
Cancels the given task.
|
void |
executeTask(long jobId,
long taskId,
RunTaskCommand runTaskCommand,
RunTaskContext context)
Executes the given task.
|
java.util.List<TaskInfo> |
getAndClearTaskUpdates() |
int |
getNumActiveTasks() |
int |
getTaskExecutorPoolSize() |
void |
notifyTaskCompletion(long jobId,
long taskId,
java.io.Serializable result)
Notifies the completion of the task.
|
void |
notifyTaskFailure(long jobId,
long taskId,
java.lang.Throwable t)
Notifies the failure of the task.
|
void |
notifyTaskRunning(long jobId,
long taskId)
Noitfy the start of the task.
|
void |
restoreTaskUpdates(java.util.List<TaskInfo> tasks)
Adds the given tasks to the task updates data structure.
|
void |
setDefaultTaskExecutorPoolSize(int defaultTaskExecutorPoolSize)
Sets the number of threads in the task executor pool when not throttled.
|
void |
throttle()
Throttle the TaskExecutorManager.
|
int |
unfinishedTasks() |
void |
unthrottle()
Unthrottle the TaskExecutorManager.
|
public TaskExecutorManager(int taskExecutorPoolSize,
WorkerNetAddress address)
TaskExecutorManager.taskExecutorPoolSize - number of task executors in the pooladdress - the worker addresspublic int getNumActiveTasks()
public int getTaskExecutorPoolSize()
public void setDefaultTaskExecutorPoolSize(int defaultTaskExecutorPoolSize)
defaultTaskExecutorPoolSize - number of threads in the task executor poolpublic void throttle()
public void unthrottle()
public int unfinishedTasks()
public void notifyTaskRunning(long jobId,
long taskId)
jobId - the job idtaskId - the task idpublic void notifyTaskCompletion(long jobId,
long taskId,
java.io.Serializable result)
jobId - the job idtaskId - the task idresult - the task execution resultpublic void notifyTaskFailure(long jobId,
long taskId,
java.lang.Throwable t)
jobId - the job idtaskId - the task idt - the thrown exceptionpublic void executeTask(long jobId,
long taskId,
RunTaskCommand runTaskCommand,
RunTaskContext context)
jobId - the job idtaskId - the task idrunTaskCommand - the run task commandcontext - the context of the workerpublic void cancelTask(long jobId,
long taskId)
jobId - the job idtaskId - the task idpublic java.util.List<TaskInfo> getAndClearTaskUpdates()
public void restoreTaskUpdates(java.util.List<TaskInfo> tasks)
tasks - the tasks to restoreCopyright © 2022. All Rights Reserved.