diff --git a/core/impl/src/main/java/org/jboss/jca/core/connectionmanager/pool/mcp/SemaphoreConcurrentLinkedDequeManagedConnectionPool.java b/core/impl/src/main/java/org/jboss/jca/core/connectionmanager/pool/mcp/SemaphoreConcurrentLinkedDequeManagedConnectionPool.java index 037b230da..a0f76845d 100644 --- a/core/impl/src/main/java/org/jboss/jca/core/connectionmanager/pool/mcp/SemaphoreConcurrentLinkedDequeManagedConnectionPool.java +++ b/core/impl/src/main/java/org/jboss/jca/core/connectionmanager/pool/mcp/SemaphoreConcurrentLinkedDequeManagedConnectionPool.java @@ -573,7 +573,14 @@ else if (debug) { if (pool.getInternalStatistics().isEnabled()) pool.getInternalStatistics().deltaBlockingFailureCount(); - + synchronized (cls) { + if (cls.isEmpty()) { + if (debug) { + log.debug("Timeout trying acquire lock but cls is empty. Releasing the orphaned lock"); + } + pool.getLock().release(); + } + } // We timed out throw new ResourceException( bundle.noMManagedConnectionsAvailableWithinConfiguredBlockingTimeout( @@ -746,7 +753,7 @@ else if (debug) cl.destroy(); } - if (releasePermit) + if (releasePermit || (clw != null && clw.hasPermit())) { pool.getLock().release(); }