org.jppf.jca.work.submission
Class JPPFSubmissionManager

java.lang.Object
  extended by org.jppf.utils.ThreadSynchronization
      extended by org.jppf.jca.work.submission.JPPFSubmissionManager
All Implemented Interfaces:
Runnable, Work

public class JPPFSubmissionManager
extends ThreadSynchronization
implements Work

This task provides asynchronous management of tasks submitted through the resource adapter. It relies on a queue where job are first added, then submitted when a driver connection becomes available. It also provides methods to check the status of a submission and retrieve the results.

Author:
Laurent Cohen

Nested Class Summary
 class JPPFSubmissionManager.JobSubmission
          Wrapper for submitting a job.
 
Field Summary
 
Fields inherited from class org.jppf.utils.ThreadSynchronization
stopped
 
Constructor Summary
JPPFSubmissionManager(JPPFJcaClient client)
          Initialize this submission worker with the specified JPPF client.
 
Method Summary
 String addExistingSubmission(JPPFJob job)
          Add an existing submission back into the execution queue.
 String addSubmission(JPPFJob job)
          Add a task submission to the execution queue.
 String addSubmission(JPPFJob job, SubmissionStatusListener listener)
          Add a task submission to the execution queue.
 Collection<String> getAllSubmissionIds()
          Get the ids of all currently available submissions.
 JPPFSubmissionResult peekSubmission(String id)
          Get a submission given its id, without removing it from this submissison manager.
 JPPFSubmissionResult pollSubmission(String id)
          Get a submission given its id, and remove it from this submissison manager.
 void release()
          Stop this submission manager.
 void run()
          Run the loop of this submission manager, watching for the queue and starting a job when the queue has one and a connnection is available.
 
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
 

Constructor Detail

JPPFSubmissionManager

public JPPFSubmissionManager(JPPFJcaClient client)
Initialize this submission worker with the specified JPPF client.

Parameters:
client - the JPPF client that manages connections to the JPPF drivers.
Method Detail

release

public void release()
Stop this submission manager.

Specified by:
release in interface Work
See Also:
Work.release()

run

public void run()
Run the loop of this submission manager, watching for the queue and starting a job when the queue has one and a connnection is available.

Specified by:
run in interface Runnable
See Also:
Runnable.run()

addSubmission

public String addSubmission(JPPFJob job)
Add a task submission to the execution queue.

Parameters:
job - encapsulation of the execution data.
Returns:
the unique id of the submission.

addSubmission

public String addSubmission(JPPFJob job,
                            SubmissionStatusListener listener)
Add a task submission to the execution queue.

Parameters:
job - encapsulation of the execution data.
listener - an optional listener to receive submission status change notifications, may be null.
Returns:
the unique id of the submission.

addExistingSubmission

public String addExistingSubmission(JPPFJob job)
Add an existing submission back into the execution queue.

Parameters:
job - encapsulation of the execution data.
Returns:
the unique id of the submission.

peekSubmission

public JPPFSubmissionResult peekSubmission(String id)
Get a submission given its id, without removing it from this submissison manager.

Parameters:
id - the id of the submission to find.
Returns:
the submisison corresponding to the id, or null if the submission could not be found.

pollSubmission

public JPPFSubmissionResult pollSubmission(String id)
Get a submission given its id, and remove it from this submissison manager.

Parameters:
id - the id of the submission to find.
Returns:
the submisison corresponding to the id, or null if the submission could not be found.

getAllSubmissionIds

public Collection<String> getAllSubmissionIds()
Get the ids of all currently available submissions.

Returns:
a collection of ids as strings.


Copyright © 2005-2010 JPPF Team.