Class RollbackOnConnectionClosePoolInterceptor

java.lang.Object
io.quarkus.jdbc.oracle.runtime.RollbackOnConnectionClosePoolInterceptor
All Implemented Interfaces:
io.agroal.api.AgroalPoolInterceptor

public class RollbackOnConnectionClosePoolInterceptor extends Object implements io.agroal.api.AgroalPoolInterceptor
Oracle has the weird behavior that it performs an implicit commit on normal connection closure (even with auto-commit disabled), which happens on application shutdown. To prevent whatever intermittent state we have during shutdown from being committed, we add an explicit rollback to each connection closure. If the connection has already received a COMMIT, the rollback will not work, which is fine.

The code unwraps the Connection so that we perform the rollback directly on the underlying database connection, and not on e.g. Agroal's ConnectionWrapper which can prevent the rollback from actually being executed due to some safeguards.

  • Constructor Details

    • RollbackOnConnectionClosePoolInterceptor

      public RollbackOnConnectionClosePoolInterceptor()
  • Method Details

    • onConnectionDestroy

      public void onConnectionDestroy(Connection connection)
      Specified by:
      onConnectionDestroy in interface io.agroal.api.AgroalPoolInterceptor