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 Details

    • execute

      void execute(BundleWithTasks bundleWithTakss) throws Exception
      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

      void cancelJob(String jobUuid, boolean callOnCancel, boolean requeue)
      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 ExecutorService instance.
    • 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 ThreadManager instance.
    • getTaskNotificationDispatcher

      TaskExecutionDispatcher getTaskNotificationDispatcher()
      Get the object which dispatches tasks notifications to registered listeners.
      Returns:
      a TaskExecutionDispatcher instance.
    • 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

      int getNbBundles(String jobUuid)
      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

      void addExecutionManagerListener(ExecutionManagerListener listener)
      Register a listener with this execution manager.
      Parameters:
      listener - the listener to register.
    • removeExecutionManagerListener

      void removeExecutionManagerListener(ExecutionManagerListener listener)
      Remove a listener from the registered listeners.
      Parameters:
      listener - the listener to remove.
    • taskEnded

      void taskEnded(NodeTaskWrapper taskWrapper)
      Notification that a task has finished executing.
      Parameters:
      taskWrapper - the task that finished its execution.
    • addPendingJobEntry

      void addPendingJobEntry(TaskBundle bundle)
      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.