Class ServerTaskBundleClient

java.lang.Object
org.jppf.server.protocol.ServerTaskBundleClient

public class ServerTaskBundleClient extends Object
Instances of this class group tasks from the same client channel together.
Author:
Laurent Cohen, Martin JANDA
  • Constructor Details

    • ServerTaskBundleClient

      public ServerTaskBundleClient(org.jppf.node.protocol.TaskBundle job, org.jppf.io.DataLocation dataProvider, List<org.jppf.io.DataLocation> taskList, boolean forPeer)
      Initialize this task bundle and set its build number.
      Parameters:
      job - the job to execute.
      dataProvider - the shared data provider for this task bundle.
      taskList - the tasks to execute.
      forPeer - whether the job comes from a peer driver.
    • ServerTaskBundleClient

      public ServerTaskBundleClient(Collection<ServerTask> tasks, org.jppf.node.protocol.TaskBundle job, org.jppf.io.DataLocation dataProvider)
      Initialize this task bundle and set its build number.
      Parameters:
      tasks - the tasks to execute.
      job - the job to execute.
      dataProvider - the shared data provider for this task bundle.
  • Method Details

    • getJob

      public org.jppf.node.protocol.TaskBundle getJob()
      Get the job this submission is for.
      Returns:
      a TaskBundle instance.
    • getDataProvider

      public org.jppf.io.DataLocation getDataProvider()
      Get shared data provider for this task.
      Returns:
      a DataProvider instance.
    • getTaskList

      public List<ServerTask> getTaskList()
      Get the tasks to be executed by the node.
      Returns:
      the tasks as a List of arrays of bytes.
    • handleNullTasks

      public void handleNullTasks()
      Send back the null tasks immediately.
    • resultReceived

      public void resultReceived(Collection<ServerTask> results)
      Called to notify that the contained task received result.
      Parameters:
      results - the tasks for which results were received.
    • resultReceived

      public void resultReceived(Collection<ServerTask> tasks, Throwable exception)
      Called to notify that the task received exception during execution.
      Parameters:
      tasks - the tasks for which an exception was received.
      exception - the exception.
    • getJobReceivedTime

      public long getJobReceivedTime()
      Get the job received time.
      Returns:
      the time in milliseconds as a long value.
    • setJobReceivedTime

      public void setJobReceivedTime(long jobReceivedTime)
      Set the job received time.
      Parameters:
      jobReceivedTime - the time in milliseconds as a long value.
    • cancel

      public void cancel()
      Called when this task bundle is cancelled.
    • isCancelled

      public boolean isCancelled()
      Get the cancelled indicator.
      Returns:
      true if job is cancelled, false otherwise.
    • isDone

      public boolean isDone()
      Get the done indicator.
      Returns:
      true if this client job is done, false otherwise.
    • getDataLocationList

      public List<org.jppf.io.DataLocation> getDataLocationList()
      Extract DataLocation list from contained tasks.
      Returns:
      the list of DataLocation instances.
    • getSLA

      public org.jppf.node.protocol.JobSLA getSLA()
      Get the service level agreement between the job and the server.
      Returns:
      an instance of JobSLA.
    • getUuid

      public String getUuid()
      Get the universal unique id for this bundle.
      Returns:
      the uuid as a string.
    • getTaskCount

      public int getTaskCount()
      Get the number of tasks in the bundle.
      Returns:
      the number of tasks as an int.
    • getPendingTasksCount

      public int getPendingTasksCount()
      Get the number of tasks that remain to execute.
      Returns:
      the number of tasks as an int.
    • bundleEnded

      public void bundleEnded()
      Notifies that bundle is completely executed.
    • addCompletionListener

      public void addCompletionListener(ServerTaskBundleClient.CompletionListener listener)
      Add a listener to the list of bundle listeners.
      Parameters:
      listener - a ServerTaskBundleClient.CompletionListener instance.
    • removeCompletionListener

      public void removeCompletionListener(ServerTaskBundleClient.CompletionListener listener)
      Remove a listener from the list of bundle listeners.
      Parameters:
      listener - a ServerTaskBundleClient.CompletionListener instance.
    • toString

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

      public long getId()
      Get the unique id for this client bundle.
      Returns:
      the id as a long value.
    • getOriginalBundleId

      public long getOriginalBundleId()
      Returns:
      the id of the bundle from which this one was created, if any. If this bundle is the roigial one, then its id is returned.
    • getTasksPositions

      public int[] getTasksPositions()
      Returns:
      the positions of the tasks in this bundle.
    • getTaskGraphInfo

      public org.jppf.node.protocol.graph.TaskGraphInfo getTaskGraphInfo()
      Get the dependencies of the tasks in this bundle.
      Returns:
      the list of dependencies.
    • setDependencies

      public void setDependencies(List<org.jppf.io.DataLocation> dependenciesLocations, org.jppf.node.protocol.graph.TaskGraphInfo graphInfo)
      Set the dependencies of the tasks in this bundle.
      Parameters:
      dependenciesLocations - the list of dependencies.
      graphInfo - information on the task graph, if any.