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 Detail

      • beforeConnectionCreation

        default void beforeConnectionCreation()
        This callback is invoked whenever a new connection is about to be created.
      • onConnectionCreation

        default void onConnectionCreation​(Connection connection)
        This callback is invoked for every new connection.
      • onConnectionPooled

        default void onConnectionPooled​(Connection connection)
        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

        default void onConnectionAcquire​(Connection connection)
        This callback is invoked when a connection is successfully acquired.
      • beforeConnectionReturn

        default void beforeConnectionReturn​(Connection connection)
        This callback is invoked before a connection is returned to the pool.
      • onConnectionReturn

        default void onConnectionReturn​(Connection connection)
        This callback is invoked right after a connection is returned to the pool. The connection may have been acquired concurrently.
      • beforeConnectionLeak

        default void beforeConnectionLeak​(Connection connection)
        This callback is invoked before checking the leak timeout of a connection.
      • onConnectionLeak

        default void onConnectionLeak​(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.
      • beforeConnectionValidation

        default void beforeConnectionValidation​(Connection connection)
        This callback is invoked when a connection is about to be checked.
      • onConnectionValid

        default void onConnectionValid​(Connection connection)
        This callback is invoked when a connection was checked and is valid.
      • onConnectionInvalid

        default void onConnectionInvalid​(Connection connection)
        This callback is invoked when a connection was checked and is invalid. The connection will be destroyed.
      • beforeConnectionFlush

        default void beforeConnectionFlush​(Connection connection)
        This callback is invoked when a connection is about to be flush. It may not be flushed.
      • onConnectionFlush

        default void onConnectionFlush​(Connection connection)
        This callback is invoked when after a connection is removed from the pool.
      • beforeConnectionReap

        default void beforeConnectionReap​(Connection connection)
        This callback is invoked before checking the idle timeout of a connection.
      • onConnectionReap

        default void onConnectionReap​(Connection connection)
        This callback is invoked if a connection is idle in the pool. The connection will be destroyed.
      • beforeConnectionDestroy

        default void beforeConnectionDestroy​(Connection connection)
        This callback is invoked whenever a connection is about to be destroyed.
      • onConnectionDestroy

        default void onConnectionDestroy​(Connection connection)
        This callback is invoked after a connection is closed.
      • onWarning

        default void onWarning​(String message)
        This callback is invoked to report anomalous circumstances that do not prevent the pool from functioning.
      • onWarning

        default void onWarning​(Throwable throwable)
        This callback is invoked to report anomalous circumstances that do not prevent the pool from functioning.
      • onInfo

        default void onInfo​(String message)
        Callback to allow reporting information of interest, for which a warning might be considered excessive.