From 6bdfe95f665d19b868b8246358941b72419512ab Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Tue, 23 Feb 2016 15:03:57 -0500 Subject: [PATCH] ARTEMIS-350 small improvement on the writable logic --- .../activemq/artemis/core/replication/ReplicationManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationManager.java index 8f0774e052..a393816714 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationManager.java @@ -110,7 +110,7 @@ public final class ReplicationManager implements ActiveMQComponent, ReadyListene private volatile boolean enabled; - private final AtomicBoolean writable = new AtomicBoolean(false); + private final AtomicBoolean writable = new AtomicBoolean(true); private final Object replicationLock = new Object(); @@ -345,6 +345,7 @@ public final class ReplicationManager implements ActiveMQComponent, ReadyListene pendingTokens.add(repliToken); if (!replicatingChannel.getConnection().isWritable(this)) { try { + writable.set(false); //don't wait for ever as this may hang tests etc, we've probably been closed anyway long now = System.currentTimeMillis(); long deadline = now + 5000; @@ -352,7 +353,6 @@ public final class ReplicationManager implements ActiveMQComponent, ReadyListene replicationLock.wait(deadline - now); now = System.currentTimeMillis(); } - writable.set(false); } catch (InterruptedException e) { throw new ActiveMQInterruptedException(e);