Package org.firebirdsql.gds.ng
Class AbstractFbTransaction
- java.lang.Object
- 
- org.firebirdsql.gds.ng.AbstractFbTransaction
 
- 
- All Implemented Interfaces:
- FbTransaction,- ExceptionListenable
 - Direct Known Subclasses:
- JnaTransaction,- V10Transaction
 
 public abstract class AbstractFbTransaction extends java.lang.Object implements FbTransaction - Since:
- 3.0
- Author:
- Mark Rotteveel
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected ExceptionListenerDispatcherexceptionListenerDispatcherprotected TransactionListenerDispatchertransactionListenerDispatcher
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedAbstractFbTransaction(TransactionState initialState, FbDatabase database)Initializes AbstractFbTransaction.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddExceptionListener(ExceptionListener listener)Adds an exception listener to this object.voidaddTransactionListener(TransactionListener listener)Adds aTransactionListenerto the list of strongly referenced listeners.voidaddWeakTransactionListener(TransactionListener listener)Adds aTransactionListenerto the list of weakly referenced listeners.protected voidfinalize()protected FbDatabasegetDatabase()TransactionStategetState()protected java.lang.ObjectgetSynchronizationObject()Get synchronization object.longgetTransactionId()Retrieves the transaction id.<T> TgetTransactionInfo(byte[] requestItems, int bufferLength, InfoProcessor<T> infoProcessor)Request transaction info.voidremoveExceptionListener(ExceptionListener listener)Removes an exception listener to this object.voidremoveTransactionListener(TransactionListener listener)Removes theTransactionListenerfrom the list of listeners.protected voidswitchState(TransactionState newState)Switches current state to the supplied newState.- 
Methods inherited from class java.lang.Objectclone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.firebirdsql.gds.ng.FbTransactioncommit, getHandle, getTransactionInfo, prepare, rollback
 
- 
 
- 
- 
- 
Field Detail- 
exceptionListenerDispatcherprotected final ExceptionListenerDispatcher exceptionListenerDispatcher 
 - 
transactionListenerDispatcherprotected final TransactionListenerDispatcher transactionListenerDispatcher 
 
- 
 - 
Constructor Detail- 
AbstractFbTransactionprotected AbstractFbTransaction(TransactionState initialState, FbDatabase database) Initializes AbstractFbTransaction.- Parameters:
- initialState- Initial transaction state (allowed values are- TransactionState.ACTIVEand- TransactionState.PREPARED.
- database- FbDatabase that created this handle.
 
 
- 
 - 
Method Detail- 
getStatepublic final TransactionState getState() - Specified by:
- getStatein interface- FbTransaction
- Returns:
- Current transaction state
 
 - 
switchStateprotected final void switchState(TransactionState newState) throws java.sql.SQLException Switches current state to the supplied newState.- Parameters:
- newState- New state to switch to
- Throws:
- java.sql.SQLException- If the requested state transition is not allowed or if the current state is also changed in a concurrent thread.
 
 - 
addTransactionListenerpublic final void addTransactionListener(TransactionListener listener) Description copied from interface:FbTransactionAdds aTransactionListenerto the list of strongly referenced listeners.- Specified by:
- addTransactionListenerin interface- FbTransaction
- Parameters:
- listener- TransactionListener to register
 
 - 
addWeakTransactionListenerpublic final void addWeakTransactionListener(TransactionListener listener) 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 interface- FbTransaction
- Parameters:
- listener- TransactionListener to register
 
 - 
removeTransactionListenerpublic final void removeTransactionListener(TransactionListener listener) Description copied from interface:FbTransactionRemoves theTransactionListenerfrom the list of listeners.- Specified by:
- removeTransactionListenerin interface- FbTransaction
- Parameters:
- listener- TransactionListener to remove
 
 - 
addExceptionListenerpublic final void addExceptionListener(ExceptionListener listener) Description copied from interface:ExceptionListenableAdds an exception listener to this object.Implementations use WeakReference.- Specified by:
- addExceptionListenerin interface- ExceptionListenable
- Parameters:
- listener- Listener to register
 
 - 
removeExceptionListenerpublic final void removeExceptionListener(ExceptionListener listener) Description copied from interface:ExceptionListenableRemoves an exception listener to this object.- Specified by:
- removeExceptionListenerin interface- ExceptionListenable
- Parameters:
- listener- Listener to remove
 
 - 
getTransactionInfopublic <T> T getTransactionInfo(byte[] requestItems, int bufferLength, InfoProcessor<T> infoProcessor) throws java.sql.SQLExceptionDescription copied from interface:FbTransactionRequest transaction info.- Specified by:
- getTransactionInfoin interface- FbTransaction
- Parameters:
- requestItems- Array of info items to request
- bufferLength- Response buffer length to use
- infoProcessor- Implementation of- InfoProcessorto transform the info response
- Returns:
- Transformed info response of type T
- Throws:
- java.sql.SQLException- For errors retrieving or transforming the response.
 
 - 
getTransactionIdpublic long getTransactionId() throws java.sql.SQLExceptionDescription 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 interface- FbTransaction
- Returns:
- Database transaction id.
- Throws:
- java.sql.SQLException
 
 - 
getSynchronizationObjectprotected final java.lang.Object getSynchronizationObject() Get synchronization object.- Returns:
- object, cannot be null.
 
 - 
finalizeprotected void finalize() throws java.lang.Throwable- Overrides:
- finalizein class- java.lang.Object
- Throws:
- java.lang.Throwable
 
 - 
getDatabaseprotected FbDatabase getDatabase() 
 
- 
 
-