Package org.jppf.client
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 -
Method Summary
Modifier and TypeMethodDescriptionvoidaddResults(List<org.jppf.node.protocol.Task<?>> tasks) Add the specified results to this job.voidclear()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.booleanhasResult(int position) Determine whether this job received a result for the task at the specified position.intsize()Get the current number of received results.toString()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
-
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:
trueif a result was received,falseotherwise.
-
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
Taskinstance, or null if no result was received for a task at this position.
-
addResults
Add the specified results to this job.- Parameters:
tasks- the list of tasks for which results were received.
-
getAllResults
Get all the tasks received as results for this job.- Returns:
- a collection of
Taskinstances.
-
getResultsList
Get all the tasks received as results for this job.- Returns:
- a collection of
Taskinstances.
-
toString
-
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.
-