- All Superinterfaces:
ExceptionListenable
- All Known Subinterfaces:
FbWireTransaction
- All Known Implementing Classes:
AbstractFbTransaction,V10Transaction
Handle for a transaction.
All methods defined in this interface are required to notify all SQLException thrown from the methods
defined in this interface.
- Since:
- 3.0
- Author:
- Mark Rotteveel
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddTransactionListener(TransactionListener listener) Adds aTransactionListenerto the list of strongly referenced listeners.voidAdds aTransactionListenerto the list of weakly referenced listeners.voidcommit()Commit the transactionintgetState()longRetrieves the transaction id.byte[]getTransactionInfo(byte[] requestItems, int maxBufferLength) Performs a transaction info request.<T> TgetTransactionInfo(byte[] requestItems, int bufferLength, InfoProcessor<T> infoProcessor) Request transaction info.voidprepare(byte[] recoveryInformation) Prepare the transaction for two-phase commit/rollback.voidremoveTransactionListener(TransactionListener listener) Removes theTransactionListenerfrom the list of listeners.voidrollback()Roll back the transactionMethods inherited from interface org.firebirdsql.gds.ng.listeners.ExceptionListenable
addExceptionListener, removeExceptionListener
-
Method Details
-
getState
TransactionState getState()- Returns:
- Current transaction state
-
getHandle
int getHandle()- Returns:
- The Firebird transaction handle identifier
-
addTransactionListener
Adds aTransactionListenerto the list of strongly referenced listeners.- Parameters:
listener- TransactionListener to register
-
addWeakTransactionListener
Adds aTransactionListenerto the list of weakly referenced listeners.If the listener is already strongly referenced, this call will be ignored
- Parameters:
listener- TransactionListener to register
-
removeTransactionListener
Removes theTransactionListenerfrom the list of listeners.- Parameters:
listener- TransactionListener to remove
-
commit
Commit the transaction- Throws:
SQLException
-
rollback
Roll back the transaction- Throws:
SQLException
-
prepare
Prepare the transaction for two-phase commit/rollback.- Parameters:
recoveryInformation- Transaction recovery information (stored in RDB$TRANSACTION_DESCRIPTION of RDB$TRANSACTIONS), ornullto prepare without recovery information.- Throws:
SQLException
-
getTransactionInfo
<T> T getTransactionInfo(byte[] requestItems, int bufferLength, InfoProcessor<T> infoProcessor) throws SQLException Request transaction info.- Parameters:
requestItems- Array of info items to requestbufferLength- Response buffer length to useinfoProcessor- Implementation ofInfoProcessorto transform the info response- Returns:
- Transformed info response of type T
- Throws:
SQLException- For errors retrieving or transforming the response.
-
getTransactionInfo
Performs a transaction info request.- Parameters:
requestItems- Information items to requestmaxBufferLength- Maximum response buffer length to use- Returns:
- The response buffer (note: length is the actual length of the
response, not
maxBufferLength - Throws:
SQLException- For errors retrieving the information.
-
getTransactionId
Retrieves the transaction id.The transaction id is the database transaction id, not to be confused with the attachment level transaction handle provided by
getHandle().- Returns:
- Database transaction id.
- Throws:
SQLException
-