Uploaded image for project: 'Agroal'
  1. Agroal
  2. AG-136

Add a safe callback interface for pool events

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Major Major
    • 1.8
    • 1.7
    • api, pool
    • None

      There is a need for a callback to intercept pool events that is safe for applications to use.

      Right now the current listener interface is fine for container implementations, but should not be used by higher level applications because:

      • The AgroalDataSourceListener interface was not designed with the Interceptor concept in mind. Agroal always invoke the listeners in the given order, so if there are 2 listeners with common concerns,only one of them will be effective.
      • The Listener gives access to the raw java.sql.Connection and therefore any error may cause chaos on the pool (leave an invalid connection on the pool, etc.)
      • Some methods on the listener are invoked by Agroal's own thread and therefore should not execute any long running task (that is not a problem in the context of this issue, but may be if we expose this interface as API)
      • When running Agroal with a TransactionManager, the life-cycle of the connections can be slightly different as this is associated with the transaction. This does not map well on the current listener interface.

      A new interface PoolInteceptor should be added to address this issues.

              lbarreiro-1 Luis Barreiro
              lbarreiro-1 Luis Barreiro
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: