for (MessageExchange me : exchanges) {
if (me.getResponseMessage().getOp() !=
elections.getProtocol().PROMISE) {
continue;
}
final Promise p = (Promise) me.getResponseMessage();
if (p.getPriority() == 0) {
zeroPrioNodes++;
continue;
}
if (calculator.skipPromiseDueToVersion(p.getLogVersion())) {
continue;
}
if (p.getSuggestionRanking() < maxRanking) {
continue;
}
/* Use priority as a tie breaker. */
if (p.getSuggestionRanking() == maxRanking) {
if (p.getPriority() < maxPriority) {
continue;
}
/*
* Use socket address to choose in case of a tie, so we
* always have a consistent ordering.
*/
if ((p.getPriority() == maxPriority) &&
((maxTarget != null) &&
(me.target.toString().compareTo(maxTarget) <= 0))) {
continue;
}
}
acceptorValue = p.getSuggestion();
maxRanking = p.getSuggestionRanking();
maxPriority = p.getPriority();
maxTarget = me.target.toString();
}
if ((acceptorValue == null) && (zeroPrioNodes > 0)) {
LoggerUtils.logMsg(logger, elections.getRepImpl(),