HHH-14404 Remove check for concurrent execution of LogicalConnectionManagedImpl#releaseConnection

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 <yoann@hibernate.org>
This commit is contained in:
Yoann Rodière 2021-01-20 08:44:28 +01:00 committed by Sanne Grinovero
parent 8210bc220b
commit 4c9c2a809a
1 changed files with 0 additions and 8 deletions

View File

@ -205,15 +205,7 @@ public class LogicalConnectionManagedImpl extends AbstractLogicalConnectionImple
// when releasing resources, we'll abort the batch statement, // when releasing resources, we'll abort the batch statement,
// which will trigger "logicalConnection.afterStatement()", // which will trigger "logicalConnection.afterStatement()",
// which in some configurations will release the connection. // 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; 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 {
try { try {
getResourceRegistry().releaseResources(); getResourceRegistry().releaseResources();