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 -
Method Summary
Modifier and TypeMethodDescriptionGets access to the rawConnectionheld by the resource.voidThe resource is no longer valid and should not be returned to the pool.voidtransactionBeforeCompletion(boolean successful) The transaction is about to complete.voidtransactionCheckCallback(TransactionAware.SQLCallable<Boolean> transactionCheck) Set a callback trap to prevent lazy / deferred enlistment.voidThe resource must commit.voidThe transaction ended and the resource is no longer enlisted.voidThe resource must rollback.voidThe resource it's now enlisted with a transaction.
-
Method Details
-
transactionStart
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
The resource must commit.- Throws:
SQLException
-
transactionRollback
The resource must rollback.- Throws:
SQLException
-
transactionEnd
The transaction ended and the resource is no longer enlisted.- Throws:
SQLException
-
transactionCheckCallback
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 rawConnectionheld by the resource. -
setFlushOnly
void setFlushOnly()The resource is no longer valid and should not be returned to the pool.
-