Class JobResults

java.lang.Object
org.jppf.utils.concurrent.ThreadSynchronization
org.jppf.client.JobResults
All Implemented Interfaces:
Serializable

public class JobResults extends org.jppf.utils.concurrent.ThreadSynchronization implements Serializable
Instances of this class hold and manage the results of a job.
Author:
Laurent Cohen
See Also:
  • Field Summary

    Fields inherited from class org.jppf.utils.concurrent.ThreadSynchronization

    stopped
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addResults(List<org.jppf.node.protocol.Task<?>> tasks)
    Add the specified results to this job.
    void
    Clear all results in case the job is manually resubmitted.
    Collection<org.jppf.node.protocol.Task<?>>
    Get all the tasks received as results for this job.
    List<org.jppf.node.protocol.Task<?>>
    Get all the tasks received as results for this job.
    org.jppf.node.protocol.Task<?>
    getResultTask(int position)
    Get the result for the task at the specified position.
    boolean
    hasResult(int position)
    Determine whether this job received a result for the task at the specified position.
    int
    Get the current number of received results.
     
    org.jppf.node.protocol.Task<?>
    waitForTask(int position)
    Wait for the execution results of the specified task to be received.
    org.jppf.node.protocol.Task<?>
    waitForTask(int position, long timeout)
    Wait for the execution results of the specified task to be received.

    Methods inherited from class org.jppf.utils.concurrent.ThreadSynchronization

    goToSleep, goToSleep, goToSleep, isStopped, setStopped, wakeUp

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • JobResults

      public JobResults()
  • Method Details

    • size

      public int size()
      Get the current number of received results.
      Returns:
      the number of results as an int.
    • hasResult

      public boolean hasResult(int position)
      Determine whether this job received a result for the task at the specified position.
      Parameters:
      position - the task position to check.
      Returns:
      true if a result was received, false otherwise.
    • getResultTask

      public org.jppf.node.protocol.Task<?> getResultTask(int position)
      Get the result for the task at the specified position.
      Parameters:
      position - the position of the task to get.
      Returns:
      a Task instance, or null if no result was received for a task at this position.
    • addResults

      public void addResults(List<org.jppf.node.protocol.Task<?>> tasks)
      Add the specified results to this job.
      Parameters:
      tasks - the list of tasks for which results were received.
    • getAllResults

      public Collection<org.jppf.node.protocol.Task<?>> getAllResults()
      Get all the tasks received as results for this job.
      Returns:
      a collection of Task instances.
    • getResultsList

      public List<org.jppf.node.protocol.Task<?>> getResultsList()
      Get all the tasks received as results for this job.
      Returns:
      a collection of Task instances.
    • toString

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

      public org.jppf.node.protocol.Task<?> waitForTask(int position)
      Wait for the execution results of the specified task to be received.
      Parameters:
      position - the position of the task in the job it is a part of.
      Returns:
      the task whose results were received, or null if the timeout expired before it was received.
    • waitForTask

      public org.jppf.node.protocol.Task<?> waitForTask(int position, long timeout)
      Wait for the execution results of the specified task to be received.
      Parameters:
      position - the position of the task in the job it is a part of.
      timeout - maximum number of milliseconds to wait.
      Returns:
      the task whose results were received, or null if the timeout expired before it was received.
    • clear

      public void clear()
      Clear all results in case the job is manually resubmitted.