Class AbstractServerJobBase

java.lang.Object
org.jppf.server.protocol.AbstractServerJob
org.jppf.server.protocol.AbstractServerJobBase
All Implemented Interfaces:
org.jppf.node.protocol.JPPFDistributedJob
Direct Known Subclasses:
ServerJob

public class AbstractServerJobBase extends AbstractServerJob
Author:
Laurent Cohen, Martin JANDA
  • Field Details

    • tasks

      protected final Map<Integer,ServerTask> tasks
      The list of the tasks.
    • clientBundles

      protected final List<ServerTaskBundleClient> clientBundles
      The list of the incoming bundles.
    • dispatchSet

      protected final Map<Long,ServerTaskBundleNode> dispatchSet
      Set of all dispatched bundles in this job.
    • channelSet

      protected final Map<String,Integer> channelSet
      Set of all nodes to which this job is dispatched.
    • onRequeue

      protected Runnable onRequeue
      The requeue handler.
    • dataProvider

      protected final org.jppf.io.DataLocation dataProvider
      The data location of the data provider.
    • totalDispatches

      protected final AtomicInteger totalDispatches
      Total number of dispatches in this job.
    • dependendedOnTasks

      protected final Map<Integer,ServerTask> dependendedOnTasks
      The list of the tasks.
  • Constructor Details

    • AbstractServerJobBase

      public AbstractServerJobBase(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

    • getClientBundles

      public List<ServerTaskBundleClient> getClientBundles()
      Get list of bundles received from client.
      Returns:
      list of bundles received from client.
    • getDataProvider

      public org.jppf.io.DataLocation getDataProvider()
      Get the location for data shared between tasks.
      Returns:
      a DataLocation instance.
    • getTaskCount

      public int getTaskCount()
      Specified by:
      getTaskCount in interface org.jppf.node.protocol.JPPFDistributedJob
      Specified by:
      getTaskCount in class AbstractServerJob
    • merge

      protected boolean merge(List<ServerTask> taskList, boolean after)
      Merge this client job wrapper with another.
      Parameters:
      taskList - list of tasks to merge.
      after - determines whether the tasks from other should be added first or last.
      Returns:
      true when this client job needs to be requeued.
    • jobDispatched

      public void jobDispatched(ServerTaskBundleNode bundle)
      Called when all or part of a job is dispatched to a node.
      Parameters:
      bundle - the dispatched job.
    • jobReturned

      public void jobReturned(ServerTaskBundleNode bundle)
      Called when all or part of a job is returned from node.
      Parameters:
      bundle - the returned job.
    • hasPending

      protected boolean hasPending()
      Get indicator whether job has pending tasks.
      Returns:
      true when job has some pending tasks.
    • setOnRequeue

      public void setOnRequeue(Runnable onRequeue)
      Set the requeue handler.
      Parameters:
      onRequeue - Runnable executed on requeue.
    • getNbChannels

      public int getNbChannels()
      Get count of channels on which this job is executed.
      Returns:
      the number used for job execution.
    • getNbDispatches

      public int getNbDispatches(String uuid)
      Get count of dispatches executed on the specified channel.
      Parameters:
      uuid - uuid of the channel to check.
      Returns:
      the number of dispatches to the channel.
    • getNbDispatches

      public int getNbDispatches()
      Get count of dispatches being executed.
      Returns:
      the number of dipatches.
    • getTotalDispatches

      public int getTotalDispatches()
      Returns:
      the total number of dispatches.
    • getNodeBundle

      public ServerTaskBundleNode getNodeBundle(long id)
      Get the node bundle with the specified id from the dispatch set.
      Parameters:
      id - the id of the bundle to find.
      Returns:
      a ServerTaskBundleNode instance.
    • getDispatchSet

      public Set<ServerTaskBundleNode> getDispatchSet()
      Get the dispatch set. Used for debugging purposes.
      Returns:
      a set of ServerTaskBundleNode instances.
    • addBundle

      public boolean addBundle(ServerTaskBundleClient bundle) throws JPPFJobEndedException
      Add received bundle to this server job.
      Parameters:
      bundle - the bundle to add.
      Returns:
      true when bundle was added to job. false when job is COMPLETE.
      Throws:
      JPPFJobEndedException - if the job is already ENDED.
    • hasCompleted

      public boolean hasCompleted()
      DFetermine whether this job is in COMPLETED or ENDED state.
      Returns:
      true if this job has completed, false otherwise.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getNbBundles

      public int getNbBundles()
      Get the number of client bundles.
      Returns:
      the number of bundles as an int.
    • isJobGraphAlreadyHandled

      public boolean isJobGraphAlreadyHandled()
      Returns:
      true if the job graph is already handled in another driver that dispatched the job, false otherwise.