This closes #3168
This commit is contained in:
commit
9a5f53a47c
|
@ -443,6 +443,14 @@ public interface ActiveMQServerLogger extends BasicLogger {
|
||||||
@Message(id = 221082, value = "Initializing metrics plugin {0} with properties: {1}", format = Message.Format.MESSAGE_FORMAT)
|
@Message(id = 221082, value = "Initializing metrics plugin {0} with properties: {1}", format = Message.Format.MESSAGE_FORMAT)
|
||||||
void initializingMetricsPlugin(String clazz, String properties);
|
void initializingMetricsPlugin(String clazz, String properties);
|
||||||
|
|
||||||
|
@LogMessage(level = Logger.Level.INFO)
|
||||||
|
@Message(id = 221083, value = "ignoring quorum vote as max cluster size is {0}.", format = Message.Format.MESSAGE_FORMAT)
|
||||||
|
void ignoringQuorumVote(int maxClusterSize);
|
||||||
|
|
||||||
|
@LogMessage(level = Logger.Level.INFO)
|
||||||
|
@Message(id = 221084, value = "Requested {0} quorum votes", format = Message.Format.MESSAGE_FORMAT)
|
||||||
|
void requestedQuorumVotes(int vote);
|
||||||
|
|
||||||
@LogMessage(level = Logger.Level.WARN)
|
@LogMessage(level = Logger.Level.WARN)
|
||||||
@Message(id = 222000, value = "ActiveMQServer is being finalized and has not been stopped. Please remember to stop the server before letting it go out of scope",
|
@Message(id = 222000, value = "ActiveMQServer is being finalized and has not been stopped. Please remember to stop the server before letting it go out of scope",
|
||||||
format = Message.Format.MESSAGE_FORMAT)
|
format = Message.Format.MESSAGE_FORMAT)
|
||||||
|
|
|
@ -189,7 +189,7 @@ public final class QuorumManager implements ClusterTopologyListener, ActiveMQCom
|
||||||
int voteTimeout,
|
int voteTimeout,
|
||||||
TimeUnit voteTimeoutUnit) {
|
TimeUnit voteTimeoutUnit) {
|
||||||
Objects.requireNonNull(nodeID, "nodeID");
|
Objects.requireNonNull(nodeID, "nodeID");
|
||||||
Objects.requireNonNull(nodeID, "liveConnector");
|
Objects.requireNonNull(liveConnector, "liveConnector");
|
||||||
if (!started) {
|
if (!started) {
|
||||||
throw new IllegalStateException("QuorumManager must start first");
|
throw new IllegalStateException("QuorumManager must start first");
|
||||||
}
|
}
|
||||||
|
@ -199,15 +199,18 @@ public final class QuorumManager implements ClusterTopologyListener, ActiveMQCom
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean awaitVoteComplete(QuorumVoteServerConnect quorumVote, int voteTimeout, TimeUnit voteTimeoutUnit) {
|
private boolean awaitVoteComplete(QuorumVoteServerConnect quorumVote, int voteTimeout, TimeUnit voteTimeoutUnit) {
|
||||||
|
final int maxClusterSize = this.maxClusterSize;
|
||||||
vote(quorumVote);
|
vote(quorumVote);
|
||||||
|
if (maxClusterSize > 1) {
|
||||||
try {
|
try {
|
||||||
quorumVote.await(voteTimeout, voteTimeoutUnit);
|
quorumVote.await(voteTimeout, voteTimeoutUnit);
|
||||||
} catch (InterruptedException interruption) {
|
} catch (InterruptedException interruption) {
|
||||||
// No-op. The best the quorum can do now is to return the latest number it has
|
// No-op. The best the quorum can do now is to return the latest number it has
|
||||||
ActiveMQServerLogger.LOGGER.quorumVoteAwaitInterrupted();
|
ActiveMQServerLogger.LOGGER.quorumVoteAwaitInterrupted();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
ActiveMQServerLogger.LOGGER.ignoringQuorumVote(maxClusterSize);
|
||||||
|
}
|
||||||
voteComplete(quorumVote);
|
voteComplete(quorumVote);
|
||||||
|
|
||||||
return quorumVote.getDecision();
|
return quorumVote.getDecision();
|
||||||
|
@ -246,8 +249,10 @@ public final class QuorumManager implements ClusterTopologyListener, ActiveMQCom
|
||||||
runnables.add(voteRunnable);
|
runnables.add(voteRunnable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (runnables.size() > 0) {
|
final int votes = runnables.size();
|
||||||
voteRunnables.put(quorumVote, new VoteRunnableHolder(quorumVote, runnables, runnables.size()));
|
ActiveMQServerLogger.LOGGER.requestedQuorumVotes(votes);
|
||||||
|
if (votes > 0) {
|
||||||
|
voteRunnables.put(quorumVote, new VoteRunnableHolder(quorumVote, runnables, votes));
|
||||||
|
|
||||||
for (VoteRunnable runnable : runnables) {
|
for (VoteRunnable runnable : runnables) {
|
||||||
executor.submit(runnable);
|
executor.submit(runnable);
|
||||||
|
|
Loading…
Reference in New Issue