org.jppf.jca.work.submission
Class JPPFSubmissionResult

java.lang.Object
  extended by org.jppf.utils.ThreadSynchronization
      extended by org.jppf.jca.work.submission.JPPFSubmissionResult
All Implemented Interfaces:
EventListener, TaskResultListener

public class JPPFSubmissionResult
extends ThreadSynchronization
implements TaskResultListener

This class encapsulates the results of an asynchronous tasks submission.

Author:
Laurent Cohen

Field Summary
 
Fields inherited from class org.jppf.utils.ThreadSynchronization
stopped
 
Method Summary
 void addSubmissionStatusListener(SubmissionStatusListener listener)
          Add a listener to the list of status listeners.
protected  void fireStatusChangeEvent()
          Notify all listeners of a change of status for this submision.
 String getId()
          Get the unique id of this submission.
 List<JPPFTask> getResults()
          Get the list of final results.
 SubmissionStatus getStatus()
          Get the status of this submission.
 void removeSubmissionStatusListener(SubmissionStatusListener listener)
          Remove a listener from the list of status listeners.
 void resultsReceived(TaskResultEvent event)
          Called to notify that that results of a number of tasks have been received from the server.
 void setStatus(SubmissionStatus status)
          Set the status of this submission.
 void waitForResults(long timeout)
          Wait until all results have been received, or the specified timeout expires, whichever happens first.
 
Methods inherited from class org.jppf.utils.ThreadSynchronization
goToSleep, goToSleep, goToSleep, isStopped, setStopped, wakeUp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

resultsReceived

public void resultsReceived(TaskResultEvent event)
Called to notify that that results of a number of tasks have been received from the server.

Specified by:
resultsReceived in interface TaskResultListener
Parameters:
event - the event that encapsulates the tasks that were received and related information.
See Also:
TaskResultListener.resultsReceived(org.jppf.client.event.TaskResultEvent)

waitForResults

public void waitForResults(long timeout)
Wait until all results have been received, or the specified timeout expires, whichever happens first.

Parameters:
timeout - the maximum time to wait for the result, 0 or less means no expiration.

getResults

public List<JPPFTask> getResults()
Get the list of final results.

Returns:
a list of results as tasks, or null if not all tasks have been executed.

getStatus

public SubmissionStatus getStatus()
Get the status of this submission.

Returns:
a SubmissionStatus enumerated value.

setStatus

public void setStatus(SubmissionStatus status)
Set the status of this submission.

Parameters:
status - a SubmissionStatus enumerated value.

getId

public String getId()
Get the unique id of this submission.

Returns:
the id as a string.

addSubmissionStatusListener

public void addSubmissionStatusListener(SubmissionStatusListener listener)
Add a listener to the list of status listeners.

Parameters:
listener - the listener to add.

removeSubmissionStatusListener

public void removeSubmissionStatusListener(SubmissionStatusListener listener)
Remove a listener from the list of status listeners.

Parameters:
listener - the listener to remove.

fireStatusChangeEvent

protected void fireStatusChangeEvent()
Notify all listeners of a change of status for this submision.



Copyright © 2005-2010 JPPF Team.