ARTEMIS-255 make non-blocking-failover-timeout configurable
This commit is contained in:
parent
5bfb7ac1ad
commit
717ddd1675
|
@ -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;
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue