java.lang.Object
org.firebirdsql.gds.ng.AbstractFbTransaction
- All Implemented Interfaces:
FbTransaction,ExceptionListenable
- Direct Known Subclasses:
V10Transaction
- Since:
- 3.0
- Author:
- Mark Rotteveel
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ExceptionListenerDispatcherprotected final TransactionListenerDispatcher -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractFbTransaction(TransactionState initialState, FbDatabase database) Initializes AbstractFbTransaction. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddExceptionListener(ExceptionListener listener) Adds an exception listener to this object.final voidaddTransactionListener(TransactionListener listener) Adds aTransactionListenerto the list of strongly referenced listeners.final voidAdds aTransactionListenerto the list of weakly referenced listeners.protected FbDatabasefinal TransactionStategetState()longRetrieves the transaction id.<T> TgetTransactionInfo(byte[] requestItems, int bufferLength, InfoProcessor<T> infoProcessor) Request transaction info.protected final voidlogUnexpectedState(TransactionState expectedState, System.Logger log) final voidremoveExceptionListener(ExceptionListener listener) Removes an exception listener to this object.final voidremoveTransactionListener(TransactionListener listener) Removes theTransactionListenerfrom the list of listeners.protected final voidswitchState(TransactionState newState) Switches current state to the supplied newState.protected final LockCloseablewithLock()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.firebirdsql.gds.ng.FbTransaction
commit, getHandle, getTransactionInfo, prepare, rollback
-
Field Details
-
exceptionListenerDispatcher
-
transactionListenerDispatcher
-
-
Constructor Details
-
AbstractFbTransaction
Initializes AbstractFbTransaction.- Parameters:
initialState- Initial transaction state (allowed values areTransactionState.ACTIVEandTransactionState.PREPARED).database- FbDatabase that created this handle.
-
-
Method Details
-
getState
- Specified by:
getStatein interfaceFbTransaction- Returns:
- Current transaction state
-
switchState
Switches current state to the supplied newState.- Parameters:
newState- New state to switch to- Throws:
SQLException- If the requested state transition is not allowed or if the current state is also changed in a concurrent thread.
-
addTransactionListener
Description copied from interface:FbTransactionAdds aTransactionListenerto the list of strongly referenced listeners.- Specified by:
addTransactionListenerin interfaceFbTransaction- Parameters:
listener- TransactionListener to register
-
addWeakTransactionListener
Description copied from interface:FbTransactionAdds aTransactionListenerto the list of weakly referenced listeners.If the listener is already strongly referenced, this call will be ignored
- Specified by:
addWeakTransactionListenerin interfaceFbTransaction- Parameters:
listener- TransactionListener to register
-
removeTransactionListener
Description copied from interface:FbTransactionRemoves theTransactionListenerfrom the list of listeners.- Specified by:
removeTransactionListenerin interfaceFbTransaction- Parameters:
listener- TransactionListener to remove
-
addExceptionListener
Description copied from interface:ExceptionListenableAdds an exception listener to this object.Implementations use
WeakReference.- Specified by:
addExceptionListenerin interfaceExceptionListenable- Parameters:
listener- Listener to register
-
removeExceptionListener
Description copied from interface:ExceptionListenableRemoves an exception listener to this object.- Specified by:
removeExceptionListenerin interfaceExceptionListenable- Parameters:
listener- Listener to remove
-
getTransactionInfo
public <T> T getTransactionInfo(byte[] requestItems, int bufferLength, InfoProcessor<T> infoProcessor) throws SQLException Description copied from interface:FbTransactionRequest transaction info.- Specified by:
getTransactionInfoin interfaceFbTransaction- 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.
-
getTransactionId
Description copied from interface:FbTransactionRetrieves the transaction id.The transaction id is the database transaction id, not to be confused with the attachment level transaction handle provided by
FbTransaction.getHandle().- Specified by:
getTransactionIdin interfaceFbTransaction- Returns:
- Database transaction id.
- Throws:
SQLException
-
withLock
- See Also:
-
getDatabase
-
logUnexpectedState
-