Package io.quarkus.jdbc.oracle.runtime
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.
-
Field Summary
Fields inherited from interface io.agroal.api.AgroalPoolInterceptor
DEFAULT_COMPARATOR -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.agroal.api.AgroalPoolInterceptor
getPriority, onConnectionAcquire, onConnectionCreate, onConnectionReturn
-
Constructor Details
-
RollbackOnConnectionClosePoolInterceptor
public RollbackOnConnectionClosePoolInterceptor()
-
-
Method Details
-
onConnectionDestroy
- Specified by:
onConnectionDestroyin interfaceio.agroal.api.AgroalPoolInterceptor
-