ARTEMIS-866 - quorum fixes

remove reconnect attempt as it serves no purposes as replication has stopped anyway.

Ensure if vote fails thatthe latch is counted down to avoid delay.

If we can't detect live has failed signal failure in replicating.

https://issues.apache.org/jira/browse/ARTEMIS-866
This commit is contained in:
Andy Taylor 2016-11-28 12:37:24 +00:00
parent cf1c4d16c4
commit 2d81f0a8d0
2 changed files with 6 additions and 12 deletions

View File

@ -111,7 +111,7 @@ public class QuorumVoteServerConnect extends QuorumVote<BooleanVote, Boolean> {
@Override @Override
public void allVotesCast(Topology voteTopology) { public void allVotesCast(Topology voteTopology) {
latch.countDown();
} }
@Override @Override

View File

@ -21,7 +21,6 @@ import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
import org.apache.activemq.artemis.api.core.client.SessionFailureListener; import org.apache.activemq.artemis.api.core.client.SessionFailureListener;
import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryInternal; import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryInternal;
import org.apache.activemq.artemis.core.client.impl.Topology; import org.apache.activemq.artemis.core.client.impl.Topology;
@ -82,8 +81,6 @@ public class SharedNothingBackupQuorum implements Quorum, SessionFailureListener
*/ */
private static final int LATCH_TIMEOUT = 30; private static final int LATCH_TIMEOUT = 30;
private static final int RECONNECT_ATTEMPTS = 5;
private final Object decisionGuard = new Object(); private final Object decisionGuard = new Object();
@Override @Override
@ -101,14 +98,11 @@ public class SharedNothingBackupQuorum implements Quorum, SessionFailureListener
return; return;
} }
if (!isLiveDown()) { if (!isLiveDown()) {
try { //lost connection but don't know if live is down so restart as backup as we can't replicate any more
// no point in repeating all the reconnection logic signal = BACKUP_ACTIVATION.FAILURE_REPLICATING;
sessionFactory.connect(RECONNECT_ATTEMPTS, false); } else {
return; // live is assumed to be down, backup fails-over
} catch (ActiveMQException e) { signal = BACKUP_ACTIVATION.FAIL_OVER;
if (e.getType() != ActiveMQExceptionType.NOT_CONNECTED)
ActiveMQServerLogger.LOGGER.errorReConnecting(e);
}
} }
if (networkHealthCheck != null && networkHealthCheck.check()) { if (networkHealthCheck != null && networkHealthCheck.check()) {