Package io.agroal.api.transaction
Interface TransactionAware
-
public interface TransactionAware
Interface to be implemented by a resource (a connection) that the transaction integration layer will manipulate.- Author:
- Luis Barreiro, Jesper Pedersen
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
TransactionAware.SQLCallable<T>
A callable that can throwSQLException
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Object
getConnection()
Gets access to the rawConnection
held by the resource.void
setFlushOnly()
The resource is no longer valid and should not be returned to the pool.void
transactionBeforeCompletion(boolean successful)
The transaction is about to complete.void
transactionCheckCallback(TransactionAware.SQLCallable<Boolean> transactionCheck)
Set a callback trap to prevent lazy / deferred enlistment.void
transactionCommit()
The resource must commit.void
transactionEnd()
The transaction ended and the resource is no longer enlisted.void
transactionRollback()
The resource must rollback.void
transactionStart()
The resource it's now enlisted with a transaction.
-
-
-
Method Detail
-
transactionStart
void transactionStart() throws SQLException
The resource it's now enlisted with a transaction.- Throws:
SQLException
-
transactionBeforeCompletion
void transactionBeforeCompletion(boolean successful)
The transaction is about to complete.- Parameters:
successful
- If the transaction is to complete successfully (commit) or unsuccessfully (rollback)
-
transactionCommit
void transactionCommit() throws SQLException
The resource must commit.- Throws:
SQLException
-
transactionRollback
void transactionRollback() throws SQLException
The resource must rollback.- Throws:
SQLException
-
transactionEnd
void transactionEnd() throws SQLException
The transaction ended and the resource is no longer enlisted.- Throws:
SQLException
-
transactionCheckCallback
void transactionCheckCallback(TransactionAware.SQLCallable<Boolean> transactionCheck)
Set a callback trap to prevent lazy / deferred enlistment. Agroal supports neither of those features. This callback is set when the resource is obtained outside the scope of a running transaction and allows the resource to check if it's used within a transaction later on.
-
getConnection
Object getConnection()
Gets access to the rawConnection
held by the resource.
-
setFlushOnly
void setFlushOnly()
The resource is no longer valid and should not be returned to the pool.
-
-