Repository: activemq-artemis Updated Branches: refs/heads/master 5bfb7ac1a -> 78410bcbf
ARTEMIS-255 make non-blocking-failover-timeout configurable Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/717ddd16 Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/717ddd16 Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/717ddd16 Branch: refs/heads/master Commit: 717ddd1675dec483f2d3fb85b408f73a0488f8ea Parents: 5bfb7ac Author: jbertram <jbert...@apache.org> Authored: Mon Oct 12 13:38:56 2015 -0500 Committer: jbertram <jbert...@apache.org> Committed: Mon Oct 12 13:38:56 2015 -0500 ---------------------------------------------------------------------- .../artemis/api/core/client/ActiveMQClient.java | 2 +- .../core/client/ActiveMQClientMessageBundle.java | 3 +++ .../artemis/core/protocol/core/impl/ChannelImpl.java | 14 ++++++++++---- 3 files changed, 14 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/717ddd16/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ActiveMQClient.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ActiveMQClient.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ActiveMQClient.java index 028b6c8..1bb8d38 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ActiveMQClient.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ActiveMQClient.java @@ -72,7 +72,7 @@ public final class ActiveMQClient { public static final long DEFAULT_CALL_TIMEOUT = 30000; - public static final long DEFAULT_CALL_FAILOVER_TIMEOUT = -1; + public static final long DEFAULT_CALL_FAILOVER_TIMEOUT = 30000; public static final int DEFAULT_ACK_BATCH_SIZE = 1024 * 1024; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/717ddd16/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/ActiveMQClientMessageBundle.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/ActiveMQClientMessageBundle.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/ActiveMQClientMessageBundle.java index f0543d1..c23e9bb 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/ActiveMQClientMessageBundle.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/ActiveMQClientMessageBundle.java @@ -227,4 +227,7 @@ public interface ActiveMQClientMessageBundle { @Message(id = 119060, value = "Large Message Transmission interrupted on consumer shutdown.") ActiveMQLargeMessageInterruptedException largeMessageInterrupted(); + + @Message(id = 119061, value = "Cannot send a packet while channel is failing over.") + IllegalStateException cannotSendPacketDuringFailover(); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/717ddd16/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ChannelImpl.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ChannelImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ChannelImpl.java index 373bfa4..57ed1e8 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ChannelImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ChannelImpl.java @@ -228,9 +228,15 @@ public final class ChannelImpl implements Channel { try { if (failingOver) { - // TODO - don't hardcode this timeout try { - failoverCondition.await(10000, TimeUnit.MILLISECONDS); + if (connection.getBlockingCallFailoverTimeout() < 0) { + failoverCondition.await(); + } + else { + if (!failoverCondition.await(connection.getBlockingCallFailoverTimeout(), TimeUnit.MILLISECONDS)) { + ActiveMQClientLogger.LOGGER.debug("timed-out waiting for fail-over condition on non-blocking send"); + } + } } catch (InterruptedException e) { throw new ActiveMQInterruptedException(e); @@ -239,7 +245,7 @@ public final class ChannelImpl implements Channel { // Sanity check if (transferring) { - throw new IllegalStateException("Cannot send a packet while channel is doing failover"); + throw ActiveMQClientMessageBundle.BUNDLE.cannotSendPacketDuringFailover(); } if (resendCache != null && packet.isRequiresConfirmations()) { @@ -302,7 +308,7 @@ public final class ChannelImpl implements Channel { } else { if (!failoverCondition.await(connection.getBlockingCallFailoverTimeout(), TimeUnit.MILLISECONDS)) { - ActiveMQClientLogger.LOGGER.debug("timed-out waiting for failover condition"); + ActiveMQClientLogger.LOGGER.debug("timed-out waiting for fail-over condition on blocking send"); } } }