Package io.agroal.api
Interface AgroalPoolInterceptor
-
public interface AgroalPoolInterceptor
Callback interface for pool actions.These differ from the Listener in a few different ways: They do not have access to the raw Connection The invoke order is dependent on the operation (incoming / outgoing) Consistent with the transaction.
- Author:
- Luis Barreiro
-
-
Field Summary
Fields Modifier and Type Field Description static Comparator<AgroalPoolInterceptor>
DEFAULT_COMPARATOR
Uses interceptor priority, followed byClass.getName()
to ensure a consistent ordering.
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default int
getPriority()
Allows a ordering between multiple interceptors.default void
onConnectionAcquire(Connection connection)
This callback is invoked when a connection is successfully acquired.default void
onConnectionReturn(Connection connection)
This callback is invoked before a connection is returned to the pool.
-
-
-
Field Detail
-
DEFAULT_COMPARATOR
static final Comparator<AgroalPoolInterceptor> DEFAULT_COMPARATOR
Uses interceptor priority, followed byClass.getName()
to ensure a consistent ordering.
-
-
Method Detail
-
onConnectionAcquire
default void onConnectionAcquire(Connection connection)
This callback is invoked when a connection is successfully acquired. When in a transactional environment this is invoked only once for multiple acquire calls within the same transaction, before the connection is associated.
-
onConnectionReturn
default void onConnectionReturn(Connection connection)
This callback is invoked before a connection is returned to the pool. When in a transactional environment this is invoked only once for each transaction, after commit / rollback. This callback runs after reset, allowing connections to be in the pool in a different state than the described on the configuration.
-
getPriority
default int getPriority()
Allows a ordering between multiple interceptors. Lower priority are executed first. Negative values are reserved.
-
-