Class JPPFTaskBundle

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

public class JPPFTaskBundle extends MetadataImpl implements Comparable<JPPFTaskBundle>, TaskBundle
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 Details

    • driverQueueTaskCount

      protected int driverQueueTaskCount
      The number of tasks in this bundle at the time it is received by a driver.
    • taskCount

      protected int taskCount
      The number of tasks in this bundle.
    • currentTaskCount

      protected int currentTaskCount
      The current number of tasks in this bundle.
    • initialTaskCount

      protected int initialTaskCount
      The initial number of tasks in this bundle.
  • Constructor Details

    • JPPFTaskBundle

      public JPPFTaskBundle()
      Initialize this task bundle and set its build number.
    • JPPFTaskBundle

      public JPPFTaskBundle(TraversalList<String> uuidPath)
      Initialize this task bundle with the specified uuid path.
      Parameters:
      uuidPath - the uuidPath to set.
  • Method Details

    • getUuidPath

      public TraversalList<String> getUuidPath()
      Description copied from interface: TaskBundle
      Get the uuid path of the applications (driver or client) in whose classpath the class definition may be found.
      Specified by:
      getUuidPath in interface TaskBundle
      Returns:
      the uuid path as a list of string elements.
    • setUuidPath

      public void setUuidPath(TraversalList<String> uuidPath)
      Description copied from interface: TaskBundle
      Set the uuid path of the applications (driver or client) in whose classpath the class definition may be found.
      Specified by:
      setUuidPath in interface TaskBundle
      Parameters:
      uuidPath - the uuid path as a list of string elements.
    • getNodeExecutionTime

      public long getNodeExecutionTime()
      Description copied from interface: TaskBundle
      Get the time it took a node to execute this task.
      Specified by:
      getNodeExecutionTime in interface TaskBundle
      Returns:
      the time in milliseconds as a long value.
    • setNodeExecutionTime

      public void setNodeExecutionTime(long nodeExecutionTime)
      Description copied from interface: TaskBundle
      Set the time it took a node to execute this task.
      Specified by:
      setNodeExecutionTime in interface TaskBundle
      Parameters:
      nodeExecutionTime - the time in milliseconds as a long value.
    • getTaskCount

      public int getTaskCount()
      Description copied from interface: JPPFDistributedJob
      Get the number of tasks in the job.
      Specified by:
      getTaskCount in interface JPPFDistributedJob
      Returns:
      the number fo tasks.
    • setTaskCount

      public void setTaskCount(int taskCount)
      Description copied from interface: TaskBundle
      Set the number of tasks in this bundle.
      Specified by:
      setTaskCount in interface TaskBundle
      Parameters:
      taskCount - the number of tasks as an int.
    • setInitialTaskCount

      public void setInitialTaskCount(int initialTaskCount)
      Description copied from interface: TaskBundle
      Set the initial number of tasks in this bundle.
      Specified by:
      setInitialTaskCount in interface TaskBundle
      Parameters:
      initialTaskCount - the number of tasks as an int.
    • compareTo

      public int compareTo(JPPFTaskBundle bundle)
      Compare two task bundles, based on their respective priorities.
      Note: this class has a natural ordering that is inconsistent with equals.
      Specified by:
      compareTo in interface Comparable<JPPFTaskBundle>
      Parameters:
      bundle - the bundle compare this one to.
      Returns:
      a positive int if this bundle is greater, 0 if both are equal, or a negative int if this bundle is less than the other.
    • copy

      public JPPFTaskBundle copy()
      Description copied from interface: TaskBundle
      Make a copy of this bundle.
      Specified by:
      copy in interface TaskBundle
      Returns:
      a new JPPFTaskBundle instance.
    • getExecutionStartTime

      public long getExecutionStartTime()
      Description copied from interface: TaskBundle
      Get the time at which the bundle is taken out of the queue for sending to a node.
      Specified by:
      getExecutionStartTime in interface TaskBundle
      Returns:
      the time as a long value.
    • setExecutionStartTime

      public void setExecutionStartTime(long executionStartTime)
      Description copied from interface: TaskBundle
      Set the time at which the bundle is taken out of the queue for sending to a node.
      Specified by:
      setExecutionStartTime in interface TaskBundle
      Parameters:
      executionStartTime - the time as a long value.
    • getInitialTaskCount

      public int getInitialTaskCount()
      Description copied from interface: TaskBundle
      Get the initial task count of this bundle.
      Specified by:
      getInitialTaskCount in interface TaskBundle
      Returns:
      the task count as an int.
    • getSLA

      public JobSLA getSLA()
      Description copied from interface: JPPFDistributedJob
      Get the service level agreement between the job and the server.
      Specified by:
      getSLA in interface JPPFDistributedJob
      Returns:
      an instance of JobSLA.
    • setSLA

      public void setSLA(JobSLA jobSLA)
      Description copied from interface: TaskBundle
      Get the service level agreement between the job and the server.
      Specified by:
      setSLA in interface TaskBundle
      Parameters:
      jobSLA - an instance of JobSLA.
    • toString

      public String toString()
      Overrides:
      toString in class MetadataImpl
    • getName

      public String getName()
      Description copied from interface: JPPFDistributedJob
      Get the user-defined display name for this job. This is the name displayed in the administration console.
      Specified by:
      getName in interface JPPFDistributedJob
      Returns:
      the name as a string.
    • setName

      public void setName(String name)
      Description copied from interface: TaskBundle
      Set the user-defined display name for the job.
      Specified by:
      setName in interface TaskBundle
      Parameters:
      name - the display name as a string.
    • getMetadata

      public JobMetadata getMetadata()
      Description copied from interface: JPPFDistributedJob
      Get the user-defined metadata associated with this job.
      Specified by:
      getMetadata in interface JPPFDistributedJob
      Returns:
      a JobMetadata instance.
    • setMetadata

      public void setMetadata(JobMetadata jobMetadata)
      Description copied from interface: TaskBundle
      Set this bundle's metadata.
      Specified by:
      setMetadata in interface TaskBundle
      Parameters:
      jobMetadata - a JobMetadata instance.
    • getUuid

      public String getUuid()
      Description copied from interface: JPPFDistributedJob
      Get the universal unique id for this job.
      Specified by:
      getUuid in interface JPPFDistributedJob
      Returns:
      the uuid as a string.
    • setUuid

      public void setUuid(String jobUuid)
      Description copied from interface: TaskBundle
      Set the uuid of the initial job.
      Specified by:
      setUuid in interface TaskBundle
      Parameters:
      jobUuid - the uuid as a string.
    • getCurrentTaskCount

      public int getCurrentTaskCount()
      Description copied from interface: TaskBundle
      Get the current number of tasks in this bundle.
      Specified by:
      getCurrentTaskCount in interface TaskBundle
      Returns:
      the current number of tasks as an int.
    • setCurrentTaskCount

      public void setCurrentTaskCount(int currentTaskCount)
      Description copied from interface: TaskBundle
      Set the current number of tasks in this bundle.
      Specified by:
      setCurrentTaskCount in interface TaskBundle
      Parameters:
      currentTaskCount - the current number of tasks as an int.
    • isPending

      public boolean isPending()
      Description copied from interface: TaskBundle
      Get the job requeue flag.
      Specified by:
      isPending in interface TaskBundle
      Returns:
      job requeue flag.
    • isRequeue

      public boolean isRequeue()
      Description copied from interface: TaskBundle
      Get the job requeue flag.
      Specified by:
      isRequeue in interface TaskBundle
      Returns:
      job requeue flag.
    • setRequeue

      public void setRequeue(boolean requeue)
      Description copied from interface: TaskBundle
      Set the job requeue flag.
      Specified by:
      setRequeue in interface TaskBundle
      Parameters:
      requeue - job requeue flag.
    • getDriverQueueTaskCount

      public int getDriverQueueTaskCount()
      Description copied from interface: TaskBundle
      Get the number of tasks in this bundle at the time it is received by a driver.
      Specified by:
      getDriverQueueTaskCount in interface TaskBundle
      Returns:
      the number of tasks as an int.
    • setDriverQueueTaskCount

      public void setDriverQueueTaskCount(int driverQueueTaskCount)
      Description copied from interface: TaskBundle
      Set the number of tasks in this bundle at the time it is received by a driver.
      Specified by:
      setDriverQueueTaskCount in interface TaskBundle
      Parameters:
      driverQueueTaskCount - the number of tasks as an int.
    • isHandshake

      public boolean isHandshake()
      Description copied from interface: TaskBundle
      Determine whether this object is used for handshake instead of execution.
      Specified by:
      isHandshake in interface TaskBundle
      Returns:
      true if this bundle is a handshake bundle, false otherwise.
    • setHandshake

      public void setHandshake(boolean handshake)
      Description copied from interface: TaskBundle
      Specify whether this object is used for handshake instead of execution.
      Specified by:
      setHandshake in interface TaskBundle
      Parameters:
      handshake - true if this bundle is a handshake bundle, false otherwise.