Package io.agroal.api
Interface AgroalDataSourceListener
public interface AgroalDataSourceListener
This interface defines a set of callback methods that are invoked on events considered important for the state of the pool.
It not only allows for logging this events, but also for black-box testing.
NOTE: implementations of this methods should not block / do expensive operations.
- Author:
- Luis Barreiro
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidThis callback is invoked whenever an application tries to obtain a connection.default voidThis callback is invoked whenever a new connection is about to be created.default voidbeforeConnectionDestroy(Connection connection) This callback is invoked whenever a connection is about to be destroyed.default voidbeforeConnectionFlush(Connection connection) This callback is invoked when a connection is about to be flush.default voidbeforeConnectionLeak(Connection connection) This callback is invoked before checking the leak timeout of a connection.default voidbeforeConnectionReap(Connection connection) This callback is invoked before checking the idle timeout of a connection.default voidbeforeConnectionReturn(Connection connection) This callback is invoked before a connection is returned to the pool.default voidbeforeConnectionValidation(Connection connection) This callback is invoked when a connection is about to be checked.default voidonConnectionAcquire(Connection connection) This callback is invoked when a connection is successfully acquired.default voidonConnectionCreation(Connection connection) This callback is invoked for every new connection.default voidonConnectionDestroy(Connection connection) This callback is invoked after a connection is closed.default voidonConnectionFlush(Connection connection) This callback is invoked when after a connection is removed from the pool.default voidonConnectionInvalid(Connection connection) This callback is invoked when a connection was checked and is invalid.default voidonConnectionLeak(Connection connection, Thread thread) This connection is invoked when a connection is held for longer than the leak timeout and reports what thread acquired it.default voidonConnectionPooled(Connection connection) This callback is invoked right after a connection is added to the pool.default voidonConnectionReap(Connection connection) This callback is invoked if a connection is idle in the pool.default voidonConnectionReturn(Connection connection) This callback is invoked right after a connection is returned to the pool.default voidonConnectionValid(Connection connection) This callback is invoked when a connection was checked and is valid.default voidCallback to allow reporting information of interest, for which a warning might be considered excessive.default voidonPoolInterceptor(AgroalPoolInterceptor interceptor) Callback is invoked for each pool interceptor that is installed.default voidThis callback is invoked to report anomalous circumstances that do not prevent the pool from functioning.default voidThis callback is invoked to report anomalous circumstances that do not prevent the pool from functioning.
-
Method Details
-
beforeConnectionCreation
default void beforeConnectionCreation()This callback is invoked whenever a new connection is about to be created. -
onConnectionCreation
This callback is invoked for every new connection. -
onConnectionPooled
This callback is invoked right after a connection is added to the pool. The connection may have been acquired concurrently. -
beforeConnectionAcquire
default void beforeConnectionAcquire()This callback is invoked whenever an application tries to obtain a connection. -
onConnectionAcquire
This callback is invoked when a connection is successfully acquired. -
beforeConnectionReturn
This callback is invoked before a connection is returned to the pool. -
onConnectionReturn
This callback is invoked right after a connection is returned to the pool. The connection may have been acquired concurrently. -
beforeConnectionLeak
This callback is invoked before checking the leak timeout of a connection. -
onConnectionLeak
This connection is invoked when a connection is held for longer than the leak timeout and reports what thread acquired it. -
beforeConnectionValidation
This callback is invoked when a connection is about to be checked. -
onConnectionValid
This callback is invoked when a connection was checked and is valid. -
onConnectionInvalid
This callback is invoked when a connection was checked and is invalid. The connection will be destroyed. -
beforeConnectionFlush
This callback is invoked when a connection is about to be flush. It may not be flushed. -
onConnectionFlush
This callback is invoked when after a connection is removed from the pool. -
beforeConnectionReap
This callback is invoked before checking the idle timeout of a connection. -
onConnectionReap
This callback is invoked if a connection is idle in the pool. The connection will be destroyed. -
beforeConnectionDestroy
This callback is invoked whenever a connection is about to be destroyed. -
onConnectionDestroy
This callback is invoked after a connection is closed. -
onPoolInterceptor
Callback is invoked for each pool interceptor that is installed. -
onWarning
This callback is invoked to report anomalous circumstances that do not prevent the pool from functioning. -
onWarning
This callback is invoked to report anomalous circumstances that do not prevent the pool from functioning. -
onInfo
Callback to allow reporting information of interest, for which a warning might be considered excessive.
-