Class JPPFJobManager

java.lang.Object
org.jppf.server.job.JPPFJobManager
All Implemented Interfaces:
org.jppf.job.JobNotificationEmitter, org.jppf.job.JobTasksListenerManager, ServerJobChangeListener

public class JPPFJobManager extends Object implements ServerJobChangeListener, org.jppf.job.JobNotificationEmitter, org.jppf.job.JobTasksListenerManager
Instances of this class manage and monitor the jobs throughout their processing within the JPPF driver.
Author:
Laurent Cohen
  • Constructor Details

    • JPPFJobManager

      public JPPFJobManager(JPPFDriver driver)
      Default constructor.
      Parameters:
      driver - reference to the JPPF driver.
  • Method Details

    • getNodesForJob

      public List<ChannelJobPair> getNodesForJob(String jobUuid)
      Get all the nodes to which a all or part of a job is dispatched.
      Parameters:
      jobUuid - the id of the job.
      Returns:
      a list of ChannelJobPair instances.
    • getAllJobIds

      public String[] getAllJobIds()
      Get the set of ids for all the jobs currently queued or executing.
      Returns:
      an array of ids as strings.
    • jobDispatched

      public void jobDispatched(AbstractServerJob serverJob, org.jppf.execute.ExecutorChannel<?> channel, ServerTaskBundleNode nodeBundle)
      Description copied from interface: ServerJobChangeListener
      Called when all or part of a job is dispatched to a node.
      Specified by:
      jobDispatched in interface ServerJobChangeListener
      Parameters:
      serverJob - the dispatched job.
      channel - the node to which the job is dispatched.
      nodeBundle - the bundle for job event.
    • jobReturned

      public void jobReturned(AbstractServerJob serverJob, org.jppf.execute.ExecutorChannel<?> channel, ServerTaskBundleNode nodeBundle)
      Description copied from interface: ServerJobChangeListener
      Called when all or part of a job has returned from a node.
      Specified by:
      jobReturned in interface ServerJobChangeListener
      Parameters:
      serverJob - the returned job.
      channel - the node to which the job is dispatched.
      nodeBundle - the bundle for job event.
    • jobQueued

      public void jobQueued(ServerJob serverJob)
      Called when a job is added to the server queue.
      Parameters:
      serverJob - the queued job.
    • jobEnded

      public void jobEnded(ServerJob serverJob)
      Called when a job is complete and returned to the client.
      Parameters:
      serverJob - the completed job.
    • jobUpdated

      public void jobUpdated(AbstractServerJob job, boolean headerUpdated)
      Description copied from interface: ServerJobChangeListener
      Called when a job is added to the server queue.
      Specified by:
      jobUpdated in interface ServerJobChangeListener
      Parameters:
      job - the updated job.
      headerUpdated - whether the job header(a TaskBundle instance) has been updated.
    • jobStatusChanged

      public void jobStatusChanged(AbstractServerJob source, SubmissionStatus oldValue, SubmissionStatus newValue)
      Description copied from interface: ServerJobChangeListener
      Called when job submission status is changed.
      Specified by:
      jobStatusChanged in interface ServerJobChangeListener
      Parameters:
      source - the updated job.
      oldValue - value before change.
      newValue - value after change.
    • close

      public void close()
      Close this job manager and release its resources.
    • addJobManagerListener

      public void addJobManagerListener(org.jppf.job.JobManagerListener listener)
      Add a listener to the list of listeners.
      Parameters:
      listener - the listener to add to the list.
    • removeJobManagerListener

      public void removeJobManagerListener(org.jppf.job.JobManagerListener listener)
      Remove a listener from the list of listeners.
      Parameters:
      listener - the listener to remove from the list.
    • fireJobEvent

      public void fireJobEvent(org.jppf.job.JobNotification event)
      Fire job listener event.
      Specified by:
      fireJobEvent in interface org.jppf.job.JobNotificationEmitter
      Parameters:
      event - the event to be fired.
    • getEmitterUuid

      public String getEmitterUuid()
      Specified by:
      getEmitterUuid in interface org.jppf.job.JobNotificationEmitter
    • addJobTasksListener

      public void addJobTasksListener(org.jppf.job.JobTasksListener listener)
      Add a listener to the list of dispatch listeners.
      Specified by:
      addJobTasksListener in interface org.jppf.job.JobTasksListenerManager
      Parameters:
      listener - the listener to add to the list.
    • removeJobTasksListener

      public void removeJobTasksListener(org.jppf.job.JobTasksListener listener)
      Remove a listener from the list of dispatch listeners.
      Specified by:
      removeJobTasksListener in interface org.jppf.job.JobTasksListenerManager
      Parameters:
      listener - the listener to remove from the list.
    • jobResultsReceived

      public void jobResultsReceived(org.jppf.execute.ExecutorChannel<?> channel, ServerJob job, Collection<ServerTask> tasks)
      Called when final tasks results have been received and are about to be sent back to the client.
      Parameters:
      channel - the node to which the job is dispatched.
      job - the job for which results are received.
      tasks - the job's tasks for which there are results.
    • loadTaskReturnListeners

      public void loadTaskReturnListeners()
      Load all the dispatch listeners defined in the classpath with SPI.
    • getNotifCount

      public int getNotifCount()
      Get the count of notifications in the executor's quueue.
      Returns:
      the ocunt as an int.
    • getNotifMax

      public int getNotifMax()
      Peak count of notifications in the executor's quueue.
      Returns:
      the ocunt as an int.
    • isBroadcastDispatch

      public static boolean isBroadcastDispatch(AbstractServerJob job)
      Determine whether the specified job is the dispatch of a broadcast job to a node.
      Parameters:
      job - the job to evaluate.
      Returns:
      true if the job is the dispatch of a broadcast job, false otherwise.