Class ClientTaskBundle

java.lang.Object
org.jppf.utils.collections.MetadataImpl
org.jppf.node.protocol.JPPFTaskBundle
org.jppf.client.balancer.ClientTaskBundle
All Implemented Interfaces:
Serializable, Comparable<org.jppf.node.protocol.JPPFTaskBundle>, org.jppf.node.protocol.JPPFDistributedJob, org.jppf.node.protocol.TaskBundle, org.jppf.utils.collections.Metadata

public class ClientTaskBundle extends org.jppf.node.protocol.JPPFTaskBundle
Instances of this class group tasks from the same client together, so they are sent to the same node, avoiding unnecessary transport overhead.
The goal is to provide a performance enhancement through an adaptive bundling of tasks originating from the same client. The bundle size is computed dynamically, depending on the number of nodes connected to the server, and other factors.
Author:
Laurent Cohen
See Also:
  • Field Summary

    Fields inherited from class org.jppf.node.protocol.JPPFTaskBundle

    currentTaskCount, driverQueueTaskCount, initialTaskCount, taskCount

    Fields inherited from class org.jppf.utils.collections.MetadataImpl

    parameters
  • Constructor Summary

    Constructors
    Constructor
    Description
    ClientTaskBundle(ClientJob job, Collection<org.jppf.node.protocol.Task<?>> tasks)
    Initialize this task bundle and set its build number.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Called when this task bundle is cancelled.
    Make a copy of this bundle.
    Get the broadcast UUID.
     
    Get the client job this job is for.
    org.jppf.node.protocol.DataProvider
    Get shared data provider for this task.
    org.jppf.node.protocol.graph.TaskGraphInfo
     
    Get the job this job is for.
    List<org.jppf.node.protocol.Task<?>>
    Get the tasks to be executed by the node.
    boolean
    Get the cancelled indicator.
    boolean
    Get the requeued indicator.
    void
    Called when all or part of a job is dispatched to a node.
    void
    Called when this task bundle should be resubmitted.
    void
    Called to notify that throwable eventually raised while receiving the results.
    void
    resultsReceived(List<org.jppf.node.protocol.Task<?>> results)
    Called to notify that the results of a number of tasks have been received from the server.
    void
    setBroadcastUUID(String broadcastUUID)
    Set the broadcast UUID.
    void
    setDataProviderL(org.jppf.node.protocol.DataProvider dataProvider)
    Set shared data provider for this task.
    void
    Called to notify that the execution of a task has completed.
     

    Methods inherited from class org.jppf.node.protocol.JPPFTaskBundle

    compareTo, getCurrentTaskCount, getDriverQueueTaskCount, getExecutionStartTime, getInitialTaskCount, getMetadata, getName, getNodeExecutionTime, getSLA, getTaskCount, getUuid, getUuidPath, isHandshake, isPending, isRequeue, setCurrentTaskCount, setDriverQueueTaskCount, setExecutionStartTime, setHandshake, setInitialTaskCount, setMetadata, setName, setNodeExecutionTime, setRequeue, setSLA, setTaskCount, setUuid, setUuidPath

    Methods inherited from class org.jppf.utils.collections.MetadataImpl

    clear, getAll, getParameter, getParameter, hasParameter, removeParameter, setParameter

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.jppf.utils.collections.Metadata

    clear, getAll, getParameter, getParameter, hasParameter, removeParameter, setParameter

    Methods inherited from interface org.jppf.node.protocol.TaskBundle

    isNotification, setBundleId
  • Constructor Details

    • ClientTaskBundle

      public ClientTaskBundle(ClientJob job, Collection<org.jppf.node.protocol.Task<?>> tasks)
      Initialize this task bundle and set its build number.
      Parameters:
      job - the job to execute.
      tasks - the list of tasks to execute. This list is copy before being stored in this object, such that no link subsists between the input list and the one retained by this ClientTaskBundle.
  • Method Details

    • getJob

      public JPPFJob getJob()
      Get the job this job is for.
      Returns:
      a JPPFJob instance.
    • getClientJob

      public ClientJob getClientJob()
      Get the client job this job is for.
      Returns:
      a ClientJob instance.
    • getDataProviderL

      public org.jppf.node.protocol.DataProvider getDataProviderL()
      Get shared data provider for this task.
      Returns:
      a DataProvider instance.
    • setDataProviderL

      public void setDataProviderL(org.jppf.node.protocol.DataProvider dataProvider)
      Set shared data provider for this task.
      Parameters:
      dataProvider - a DataProvider instance.
    • getTasksL

      public List<org.jppf.node.protocol.Task<?>> getTasksL()
      Get the tasks to be executed by the node.
      Returns:
      the tasks as a List of arrays of bytes.
    • copy

      public ClientTaskBundle copy()
      Make a copy of this bundle.
      Specified by:
      copy in interface org.jppf.node.protocol.TaskBundle
      Overrides:
      copy in class org.jppf.node.protocol.JPPFTaskBundle
      Returns:
      a new ClientTaskBundle instance.
    • getBroadcastUUID

      public String getBroadcastUUID()
      Get the broadcast UUID.
      Returns:
      the broadcast UUID as a String.
    • setBroadcastUUID

      public void setBroadcastUUID(String broadcastUUID)
      Set the broadcast UUID.
      Parameters:
      broadcastUUID - the broadcast UUID as a String.
    • jobDispatched

      public void jobDispatched(ChannelWrapper channel)
      Called when all or part of a job is dispatched to a node.
      Parameters:
      channel - the node to which the job is dispatched.
    • resultsReceived

      public void resultsReceived(List<org.jppf.node.protocol.Task<?>> results)
      Called to notify that the results of a number of tasks have been received from the server.
      Parameters:
      results - the list of tasks whose results have been received from the server.
    • resultsReceived

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

      public void taskCompleted(Exception exception)
      Called to notify that the execution of a task has completed.
      Parameters:
      exception - the Exception thrown during job execution or null.
    • resubmit

      public void resubmit()
      Called when this task bundle should be resubmitted.
    • isRequeued

      public boolean isRequeued()
      Get the requeued indicator.
      Returns:
      true if job is requeued, false otherwise.
    • 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.
    • toString

      public String toString()
      Overrides:
      toString in class org.jppf.node.protocol.JPPFTaskBundle
    • getBundleId

      public Long getBundleId()
      Returns:
      the id for this bundle.
    • getGraphInfo

      public org.jppf.node.protocol.graph.TaskGraphInfo getGraphInfo()
      Returns:
      information about the task graph, if any, for a job.