Class ServerJob

All Implemented Interfaces:
org.jppf.node.protocol.JPPFDistributedJob
Direct Known Subclasses:
ServerJobBroadcast

public class ServerJob extends AbstractServerJobBase
Server-side representation of a job.
Author:
Laurent Cohen, Martin JANDA
  • Constructor Details

    • ServerJob

      public ServerJob(Lock lock, ServerJobChangeListener notificationEmitter, org.jppf.node.protocol.TaskBundle job, org.jppf.io.DataLocation dataProvider)
      Initialized client job with task bundle and list of tasks to execute.
      Parameters:
      lock - used to synchronized access to job.
      notificationEmitter - an ChangeListener instance that fires job notifications.
      job - underlying task bundle.
      dataProvider - the data location of the data provider.
  • Method Details

    • createNodeDispatch

      public ServerTaskBundleNode createNodeDispatch(int nbTasks)
      Make a copy of this client job wrapper containing only the first nbTasks tasks it contains.
      Parameters:
      nbTasks - the number of tasks to include in the copy.
      Returns:
      a new ServerJob instance.
    • resultsReceived

      public void resultsReceived(ServerTaskBundleNode bundle, List<org.jppf.io.DataLocation> results)
      Called to notify that the results of a number of tasks have been received from the server.
      Parameters:
      bundle - the executing job.
      results - the list of tasks whose results have been received from the server.
    • resultsReceived

      public void resultsReceived(ServerTaskBundleNode bundle, Throwable throwable)
      Called to notify that throwable eventually raised while receiving the results.
      Parameters:
      bundle - the finished job.
      throwable - the throwable that was raised while receiving the results.
    • taskCompleted

      public void taskCompleted(ServerTaskBundleNode bundle, Throwable throwable)
      Called to notify that the execution of a task has completed.
      Parameters:
      bundle - the completed task.
      throwable - the Exception thrown during job execution or null.
    • cancelDispatch

      public void cancelDispatch(ServerTaskBundleNode nodeBundle)
      Cancel the specified job dispatch.
      Parameters:
      nodeBundle - the dispatch to cancel.
    • cancel

      public boolean cancel(JPPFDriver driver, boolean mayInterruptIfRunning)
      Cancel this job.
      Parameters:
      driver - reference to the JPPF driver.
      mayInterruptIfRunning - true if the job may be interrupted.
      Returns:
      true if the job was effectively cncelled, false if it was already cancelled previously.
    • getNodeJobInformation

      public org.jppf.server.job.management.NodeJobInformation[] getNodeJobInformation()
      Get a list of objects describing the nodes to which the whole or part of a job was dispatched.
      Returns:
      array of NodeManagementInfo instances.
    • update

      public void update(JPPFDriver driver, org.jppf.node.protocol.JobSLA sla, org.jppf.node.protocol.JobMetadata metadata)
      Update this job with the specified sla and metadata.
      Parameters:
      driver - reference to the JPPF driver.
      sla - the SLA to update with.
      metadata - the metadata to update with.
    • getTaskGraph

      public org.jppf.node.protocol.graph.TaskGraph getTaskGraph()
      Returns:
      the graph of tasks in the job, if any.
    • hasAvailableGraphNode

      public boolean hasAvailableGraphNode()
      Returns:
      true if there is a graph and an available node in the graph, false otherwise.
    • getAvailableGraphNodeCount

      public int getAvailableGraphNodeCount()
      Returns:
      the number of nodes int he graph that can be executed.