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
FieldsModifier and TypeFieldDescriptionstatic final Comparator<AgroalPoolInterceptor>Uses interceptor priority, followed byClass.getName()to ensure a consistent ordering. -
Method Summary
Modifier and TypeMethodDescriptiondefault intAllows a ordering between multiple interceptors.default voidonConnectionAcquire(Connection connection) This callback is invoked when a connection is successfully acquired.default voidonConnectionReturn(Connection connection) This callback is invoked before a connection is returned to the pool.
-
Field Details
-
DEFAULT_COMPARATOR
Uses interceptor priority, followed byClass.getName()to ensure a consistent ordering.
-
-
Method Details
-
onConnectionAcquire
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
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.
-