Package org.jppf.execute.async
Interface AsyncExecutionManager
- All Known Implementing Classes:
AbstractAsyncExecutionManager
public interface AsyncExecutionManager
Instances of this interface manage the execution of JPPF tasks by a node.
- Author:
- Laurent Cohen
-
Method Summary
Modifier and TypeMethodDescriptionvoidRegister a listener with this execution manager.voidaddPendingJobEntry(TaskBundle bundle) Called when a task bundle s being received by the node, and before it is submitted to this execution manager.voidcancelAllTasks(boolean callOnCancel, boolean requeue) Cancel all executing or pending tasks.voidCancel all executing or pending tasks for the specified job.booleanDetermines whether the configuration has changed and resets the flag if it has.voidexecute(BundleWithTasks bundleWithTakss) Execute the specified tasks of the specified tasks bundle.Get the executor used by this execution manager.intgetNbBundles(String jobUuid) Get the number of bundles with the specified job uuid that are pending or being processed.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.voidRemove a listener from the registered listeners.voidsetThreadPoolSize(int size) Set the size of the node's thread pool.voidshutdown()Shutdown this execution manager.voidtaskEnded(NodeTaskWrapper taskWrapper) Notification that a task has finished executing.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:
bundleWithTakss- the bundle to execute with its associated tasks.- 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.
-
cancelJob
Cancel all executing or pending tasks for the specified job.- Parameters:
jobUuid- the uuid of the job to cancel.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. -
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.
-
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. -
getNbBundles
Get the number of bundles with the specified job uuid that are pending or being processed.- Parameters:
jobUuid- the uuid of the job for which to count the bundles.- Returns:
- number of bundles.
-
addExecutionManagerListener
Register a listener with this execution manager.- Parameters:
listener- the listener to register.
-
removeExecutionManagerListener
Remove a listener from the registered listeners.- Parameters:
listener- the listener to remove.
-
taskEnded
Notification that a task has finished executing.- Parameters:
taskWrapper- the task that finished its execution.
-
addPendingJobEntry
Called when a task bundle s being received by the node, and before it is submitted to this execution manager.- Parameters:
bundle- the bundle to process.
-