Package io.agroal.api.transaction
Interface TransactionIntegration
-
public interface TransactionIntegrationAgroal provides an integration point for transaction systems to modify the behaviour of the pool. The transaction layer can control the lifecycle of connections and define what connections are acquired and when these return to the pool. It is responsible for commit or rollback of the database transaction.- Author:
- Luis Barreiro
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceTransactionIntegration.ResourceRecoveryFactoryThis interface is implemented by the connection factory so that it can provide recovery resources to the transaction layer.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddResourceRecoveryFactory(TransactionIntegration.ResourceRecoveryFactory factory)Agroal calls this method on init to register itself as a XA module capable of recovery.voidassociate(TransactionAware transactionAware, XAResource xaResource)Agroal notifies the transaction layer a Tx aware resource (a connection) and it's corresponding XA resource were acquired.booleandisassociate(TransactionAware transactionAware)Agroal notifies the transaction layer that a Tx aware resource (a connection) is about to be returned to the pool.TransactionAwaregetTransactionAware()Agroal inquires the transaction layer for a Tx aware resource (a connection) that can be acquired.static TransactionIntegrationnone()The default implementation of the transaction layer, that performs no actions.voidremoveResourceRecoveryFactory(TransactionIntegration.ResourceRecoveryFactory factory)Agroal calls this method on shutdown to de-register itself as a XA module capable of recovery.
-
-
-
Method Detail
-
none
static TransactionIntegration none()
The default implementation of the transaction layer, that performs no actions.
-
getTransactionAware
TransactionAware getTransactionAware() throws SQLException
Agroal inquires the transaction layer for a Tx aware resource (a connection) that can be acquired. Usually, if there is a resource already associated with the calling thread it is returned.- Throws:
SQLException
-
associate
void associate(TransactionAware transactionAware, XAResource xaResource) throws SQLException
Agroal notifies the transaction layer a Tx aware resource (a connection) and it's corresponding XA resource were acquired. Usually, the resource is associated with the calling thread.- Throws:
SQLException
-
disassociate
boolean disassociate(TransactionAware transactionAware) throws SQLException
Agroal notifies the transaction layer that a Tx aware resource (a connection) is about to be returned to the pool. Usually, the resource is disassociated from the calling thread and returned to the pool.- Returns:
- true if the Tx aware should return to the pool, false if it should not.
- Throws:
SQLException
-
addResourceRecoveryFactory
void addResourceRecoveryFactory(TransactionIntegration.ResourceRecoveryFactory factory)
Agroal calls this method on init to register itself as a XA module capable of recovery.
-
removeResourceRecoveryFactory
void removeResourceRecoveryFactory(TransactionIntegration.ResourceRecoveryFactory factory)
Agroal calls this method on shutdown to de-register itself as a XA module capable of recovery.
-
-