Package org.jppf.execute
Interface ExecutionManager
- All Known Implementing Classes:
AbstractExecutionManager
public interface ExecutionManager
Instances of this interface manage the execution of JPPF tasks by a node.
- Author:
- Laurent Cohen
-
Method Summary
Modifier and TypeMethodDescriptionvoidcancelAllTasks(boolean callOnCancel, boolean requeue) Cancel all executing or pending tasks.booleanDetermines whether the configuration has changed and resets the flag if it has.voidexecute(TaskBundle bundle, List<Task<?>> taskList) Execute the specified tasks of the specified tasks bundle.Get the bundle whose tasks are currently being executed.Get the id of the job currently being executed.Get the executor used by this execution manager.Get the object which dispatches tasks notifications to registered listeners.Get the thread manager for this node.intGet the size of the node's thread pool.intGet the priority assigned to the execution threads.booleanDetermine whether the current job has been cancelled, including before starting its execution.voidsetBundle(TaskBundle bundle) Set the bundle whose tasks are currently being executed.voidsetJobCancelled(boolean jobCancelled) Specify whether the current job has been cancelled, including before starting its execution.voidsetThreadPoolSize(int size) Set the size of the node's thread pool.voidshutdown()Shutdown this execution manager.voidTrigger the configuration changed flag.voidupdateThreadsPriority(int newPriority) Update the priority of all execution threads.
-
Method Details
-
execute
Execute the specified tasks of the specified tasks bundle.- Parameters:
bundle- the bundle to which the tasks are associated.taskList- the list of tasks to execute.- Throws:
Exception- if the execution failed.
-
cancelAllTasks
void cancelAllTasks(boolean callOnCancel, boolean requeue) Cancel all executing or pending tasks.- Parameters:
callOnCancel- determines whether the onCancel() callback method of each task should be invoked.requeue- true if the job should be requeued on the server side, false otherwise.
-
shutdown
void shutdown()Shutdown this execution manager. -
getCurrentJobId
String getCurrentJobId()Get the id of the job currently being executed.- Returns:
- the job id as a string, or null if no job is being executed.
-
getExecutor
ExecutorService getExecutor()Get the executor used by this execution manager.- Returns:
- an
ExecutorServiceinstance.
-
setThreadPoolSize
void setThreadPoolSize(int size) Set the size of the node's thread pool.- Parameters:
size- the size as an int.
-
getThreadPoolSize
int getThreadPoolSize()Get the size of the node's thread pool.- Returns:
- the size as an int.
-
getThreadsPriority
int getThreadsPriority()Get the priority assigned to the execution threads.- Returns:
- the priority as an int value.
-
updateThreadsPriority
void updateThreadsPriority(int newPriority) Update the priority of all execution threads.- Parameters:
newPriority- the new priority to set.
-
getThreadManager
ThreadManager getThreadManager()Get the thread manager for this node.- Returns:
- a
ThreadManagerinstance.
-
isJobCancelled
boolean isJobCancelled()Determine whether the current job has been cancelled, including before starting its execution.- Returns:
trueif the job has been cancelled,falseotherwise.
-
setJobCancelled
void setJobCancelled(boolean jobCancelled) Specify whether the current job has been cancelled, including before starting its execution.- Parameters:
jobCancelled-trueif the job has been cancelled,falseotherwise.
-
getTaskNotificationDispatcher
TaskExecutionDispatcher getTaskNotificationDispatcher()Get the object which dispatches tasks notifications to registered listeners.- Returns:
- a
TaskExecutionDispatcherinstance.
-
checkConfigChanged
boolean checkConfigChanged()Determines whether the configuration has changed and resets the flag if it has.- Returns:
- true if the config was changed, false otherwise.
-
triggerConfigChanged
void triggerConfigChanged()Trigger the configuration changed flag. -
getBundle
TaskBundle getBundle()Get the bundle whose tasks are currently being executed.- Returns:
- a
TaskBundleinstance.
-
setBundle
Set the bundle whose tasks are currently being executed.- Parameters:
bundle- aTaskBundleinstance.
-