From 4c9c2a809ac6b3a3b54cd4a3cbedc53695ab9287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Wed, 20 Jan 2021 08:44:28 +0100 Subject: [PATCH] HHH-14404 Remove check for concurrent execution of LogicalConnectionManagedImpl#releaseConnection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's unlikely to ever happen, and even if it happened, the resulting exception would probably be rather clear about the fact that the problem is related to concurrent execution (ConcurrentModificationException thrown by a Map of resources, for example). See https://github.com/hibernate/hibernate-orm/pull/3693#discussion_r560393293 Signed-off-by: Yoann Rodière --- .../jdbc/internal/LogicalConnectionManagedImpl.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/resource/jdbc/internal/LogicalConnectionManagedImpl.java b/hibernate-core/src/main/java/org/hibernate/resource/jdbc/internal/LogicalConnectionManagedImpl.java index d7f45d0636..1d13e5d284 100644 --- a/hibernate-core/src/main/java/org/hibernate/resource/jdbc/internal/LogicalConnectionManagedImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/resource/jdbc/internal/LogicalConnectionManagedImpl.java @@ -205,15 +205,7 @@ public class LogicalConnectionManagedImpl extends AbstractLogicalConnectionImple // when releasing resources, we'll abort the batch statement, // which will trigger "logicalConnection.afterStatement()", // which in some configurations will release the connection. - - //Some managed containers might trigger this release concurrently: - //this is not how they should do things, still we try to detect it to trigger a more clear error. - boolean concurrentUsageDetected = ( this.physicalConnection == null ); this.physicalConnection = null; - if ( concurrentUsageDetected ) { - throw new HibernateException( "Detected concurrent management of connection resources." + - " This might indicate a multi-threaded use of Hibernate in combination with managed resources, which is not supported." ); - } try { try { getResourceRegistry().releaseResources();