org.jppf.jca.cci
Interface JPPFConnection

All Superinterfaces:
Connection, JPPFAccessor
All Known Implementing Classes:
JPPFConnectionImpl

public interface JPPFConnection
extends Connection, JPPFAccessor

Interface for JPPF JCA connections. This interface provides an API to send jobs to a JPPF driver.

Author:
Laurent Cohen

Method Summary
 void addSubmissionStatusListener(String submissionId, SubmissionStatusListener listener)
          Add a listener to the submission with the specified id.
 Collection<String> getAllSubmissionIds()
          Get the ids of all currently available submissions.
 JPPFManagedConnection getManagedConnection()
          Get the associated managed connection.
 List<JPPFTask> getSubmissionResults(String submissionId)
          Get the results of an execution request.
 SubmissionStatus getSubmissionStatus(String submissionId)
          Get the execution status of a tasks submission.
 boolean isClosed()
          Determine whether this connection has been closed.
 void removeSubmissionStatusListener(String submissionId, SubmissionStatusListener listener)
          Remove a listener from the submission with the specified id.
 void setAvailable()
          Set the closed state of this connection.
 void setManagedConnection(JPPFManagedConnection conn)
          Set the associated managed connection.
 String submitNonBlocking(JPPFJob job)
          Submit an asynchronous execution request to the JPPF client.
 String submitNonBlocking(JPPFJob job, SubmissionStatusListener listener)
          Submit an asynchronous execution request to the JPPF client.
 List<JPPFTask> waitForResults(String submissionId)
          Wait until all results for the specfied job submission have been received.
 
Methods inherited from interface javax.resource.cci.Connection
close, createInteraction, getLocalTransaction, getMetaData, getResultSetInfo
 
Methods inherited from interface org.jppf.jca.util.JPPFAccessor
getJppfClient, getLogWriter, setJppfClient, setLogWriter
 

Method Detail

submitNonBlocking

String submitNonBlocking(JPPFJob job)
                         throws Exception
Submit an asynchronous execution request to the JPPF client.
This method exits immediately after adding the request to the requests queue.
The returned id is used to later retieve the results and sttaus of the execution.

Parameters:
job - - the job to execute.
Returns:
the id of the submission, to use for later retrieval of the results and status of the submission.
Throws:
Exception - if an error occurs while submitting the request.

submitNonBlocking

String submitNonBlocking(JPPFJob job,
                         SubmissionStatusListener listener)
                         throws Exception
Submit an asynchronous execution request to the JPPF client.
This method exits immediately after adding the request to the requests queue.
The returned id is used to later retieve the results and sttaus of the execution.

Parameters:
job - the job to execute.
listener - an optional listener to receive submission status change notifications, may be null.
Returns:
the id of the submission, to use for later retrieval of the results and status of the submission.
Throws:
Exception - if an error occurs while submitting the request.

waitForResults

List<JPPFTask> waitForResults(String submissionId)
                              throws Exception
Wait until all results for the specfied job submission have been received.

Parameters:
submissionId - the id of the job submission.
Returns:
the results as a list of JPPFTask instances.
Throws:
Exception - if any error occurs.

addSubmissionStatusListener

void addSubmissionStatusListener(String submissionId,
                                 SubmissionStatusListener listener)
Add a listener to the submission with the specified id.

Parameters:
submissionId - - the id of the submission.
listener - - the listener to add.

removeSubmissionStatusListener

void removeSubmissionStatusListener(String submissionId,
                                    SubmissionStatusListener listener)
Remove a listener from the submission with the specified id.

Parameters:
submissionId - the id of the submission.
listener - the listener to remove.

getSubmissionStatus

SubmissionStatus getSubmissionStatus(String submissionId)
                                     throws Exception
Get the execution status of a tasks submission.

Parameters:
submissionId - the id of the submission for which to get the status.
Returns:
the submission status.
Throws:
Exception - if an error occurs while submitting the request.

getSubmissionResults

List<JPPFTask> getSubmissionResults(String submissionId)
                                    throws Exception
Get the results of an execution request.
This method should be called only once a call to getSubmissionStatus(submissionId) has returned either COMPLETE or FAILED

Parameters:
submissionId - the id of the submission for which to get the execution results.
Returns:
the list of resulting JPPF tasks, or null if the execution failed.
Throws:
Exception - if an error occurs while submitting the request.

getAllSubmissionIds

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

Returns:
a collection of ids as strings.

isClosed

boolean isClosed()
Determine whether this connection has been closed.

Returns:
true if the connection was closed, false otherwise.

setAvailable

void setAvailable()
Set the closed state of this connection.


getManagedConnection

JPPFManagedConnection getManagedConnection()
Get the associated managed connection.

Returns:
a JPPFManagedConnection instance.

setManagedConnection

void setManagedConnection(JPPFManagedConnection conn)
Set the associated managed connection.

Parameters:
conn - a JPPFManagedConnection instance.


Copyright © 2005-2010 JPPF Team.