Interface DatabaseFutureResult
-
public interface DatabaseFutureResult
A "future" for retrieving database results when they are available. If the query for this result used a transaction, it MUST be committed or rolled back, by callingDatabaseTransaction.commit(long)
orDatabaseTransaction.rollback(long)
on theDatabaseTransaction
used when the query request was submitted. Whether the query used a transaction or not, theclose()
method MUST be called after the SBB is finished with the ResultSet. The resource adaptor has no other way of knowing when to close the resources.See the
DatabaseQueryProvider
documentation for details on how to send a synchronous query and use of this interface.- Author:
- OpenCloud
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Closes the result set and prepared statement.String
getDataSourceNameUsed()
Which of the configured DataSource names was used for the query.boolean
getResult(long timeout)
Retrieve the result of the execute when it is available.ResultSet
getResultSet(long timeout)
Retrieve the result of the query when it is available.Statement
getStatement(long timeout)
Retrieve the Statement that was used to query the Database.int
getUpdateResult(long timeout)
Retrieve the result of the update when it is available.
-
-
-
Method Detail
-
getDataSourceNameUsed
String getDataSourceNameUsed()
Which of the configured DataSource names was used for the query.- Returns:
- the used DataSource name
-
getResultSet
ResultSet getResultSet(long timeout) throws SQLException, TimeoutException, InsufficientResourcesException, IllegalStateException, DatabaseQueryException
Retrieve the result of the query when it is available. This method will block the calling thread until the result is available, or until the time specified by either the timeout parameter or QueryTimeout value in data source configuration profile elapses. If the timeout parameter is set to 0, the QueryTimeout value will be in effect.- Parameters:
timeout
- timeout in milliseconds, 0 to use QueryTimeout from the DataSource profile- Returns:
- the JDBC ResultSet for the query
- Throws:
IllegalArgumentException
- if value of timeout negative or execute type notQueryInfo.ExecuteType.QUERY
SQLException
- if an SQL exception occurred executing the query or retrieving the result setTimeoutException
- if the specified timeout elapsesInsufficientResourcesException
- if the request could not be sent due to lack of worker threads or connectionsIllegalStateException
- if the request could not be sent due to RA entity stoppingDatabaseQueryException
- if any other problem occurs (including expiration of QueryTimeout from DataSource profile)
-
getStatement
Statement getStatement(long timeout) throws SQLException, TimeoutException, InsufficientResourcesException, IllegalStateException, DatabaseQueryException
Retrieve the Statement that was used to query the Database. This is useful for CallableStatements to get access to the OUT Parameters. This method will block the calling thread until the result is available, or until the time specified by either the timeout parameter or QueryTimeout value in data source configuration profile elapses. If the timeout parameter is set to 0, the QueryTimeout value will be in effect.- Parameters:
timeout
- timeout in milliseconds, 0 to use QueryTimeout from the DataSource profile- Returns:
- the Statement that was used to query the database
- Throws:
IllegalArgumentException
- if value of timeout negativeSQLException
- if an SQL exception occurred executing the queryTimeoutException
- if the specified timeout elapsesInsufficientResourcesException
- if the request could not be sent due to lack of worker threads or connectionsIllegalStateException
- if the request could not be sent due to RA entity stoppingDatabaseQueryException
- if any other problem occurs (including expiration of QueryTimeout from DataSource profile)- Since:
- 1.3
-
getUpdateResult
int getUpdateResult(long timeout) throws SQLException, TimeoutException, InsufficientResourcesException, IllegalStateException, DatabaseQueryException
Retrieve the result of the update when it is available. This method will block the calling thread until the result is available, or until the time specified by either the timeout parameter or QueryTimeout value in data source configuration profile elapses. If the timeout parameter is set to 0, the QueryTimeout value will be in effect.- Parameters:
timeout
- timeout in milliseconds, 0 to use QueryTimeout from the DataSource profile- Returns:
- the update result
- Throws:
IllegalArgumentException
- if value of timeout negative or execute type notQueryInfo.ExecuteType.UPDATE
SQLException
- if an SQL exception occurred executing the query or retrieving the result setTimeoutException
- if the specified timeout elapsesInsufficientResourcesException
- if the request could not be sent due to lack of worker threads or connectionsIllegalStateException
- if the request could not be sent due to RA entity stoppingDatabaseQueryException
- if any other problem occurs (including expiration of QueryTimeout from DataSource profile)- Since:
- 1.1
-
getResult
boolean getResult(long timeout) throws SQLException, TimeoutException, InsufficientResourcesException, IllegalStateException, DatabaseQueryException
Retrieve the result of the execute when it is available. This method will block the calling thread until the result is available, or until the time specified by either the timeout parameter or QueryTimeout value in data source configuration profile elapses. If the timeout parameter is set to 0, the QueryTimeout value will be in effect.- Parameters:
timeout
- timeout in milliseconds, 0 to use QueryTimeout from the DataSource profile- Returns:
- the result
- Throws:
IllegalArgumentException
- if value of timeout negative or execute type notQueryInfo.ExecuteType.EXECUTE
SQLException
- if an SQL exception occurred executing the query or retrieving the result setTimeoutException
- if the specified timeout elapsesInsufficientResourcesException
- if the request could not be sent due to lack of worker threads or connectionsIllegalStateException
- if the request could not be sent due to RA entity stoppingDatabaseQueryException
- if any other problem occurs (including expiration of QueryTimeout from DataSource profile)- Since:
- 1.3
-
close
void close()
Closes the result set and prepared statement. If this result is for a request that is not part of a transaction, then this method also closes the connection (returns it to the pool). This method MUST be called after results have been read from the ResultSet. If the request was part of a transaction,DatabaseTransaction.commit(long)
orDatabaseTransaction.rollback(long)
must also be called at some later time.
-
-