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 calling DatabaseTransaction.commit(long) or DatabaseTransaction.rollback(long) on the DatabaseTransaction used when the query request was submitted.

    Whether the query used a transaction or not, the close() 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 Detail

      • getDataSourceNameUsed

        String getDataSourceNameUsed()
        Which of the configured DataSource names was used for the query.
        Returns:
        the used DataSource name
      • 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 negative
        SQLException - if an SQL exception occurred executing the query
        TimeoutException - if the specified timeout elapses
        InsufficientResourcesException - if the request could not be sent due to lack of worker threads or connections
        IllegalStateException - if the request could not be sent due to RA entity stopping
        DatabaseQueryException - 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) or DatabaseTransaction.rollback(long) must also be called at some later time.