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
    • 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.