diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/AbstractInactivityMonitor.java b/activemq-core/src/main/java/org/apache/activemq/transport/AbstractInactivityMonitor.java index f394b3ed1f..6911f96489 100644 --- a/activemq-core/src/main/java/org/apache/activemq/transport/AbstractInactivityMonitor.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/AbstractInactivityMonitor.java @@ -153,7 +153,9 @@ public abstract class AbstractInactivityMonitor extends TransportFilter { } catch (IOException e) { onException(e); } finally { - sendLock.writeLock().unlock(); + if (sendLock.writeLock().isHeldByCurrentThread()) { + sendLock.writeLock().unlock(); + } } } };