in src/main/java/org/apache/sling/discovery/impl/cluster/voting/VotingView.java [432:464]
public boolean isWinning() {
final Resource members = getResource().getChild("members");
if (members==null) {
// the vote is being created. wait.
return false;
}
try{
final Iterable<Resource> children = members.getChildren();
final Iterator<Resource> it = children.iterator();
boolean isWinning = false;
while (it.hasNext()) {
Resource aMemberRes = it.next();
try{
ValueMap properties = aMemberRes.adaptTo(ValueMap.class);
Boolean vote = properties.get("vote", Boolean.class);
if (vote != null && vote) {
isWinning = true;
continue;
}
return false;
} catch(RuntimeException re) {
logger.info("isWinning: Could not check vote due to "+re);
return false;
}
}
return isWinning;
} catch(RuntimeException re) {
// SLING-2945: gracefully handle case where members node is
// deleted by another instance
logger.info("isWinning: could not check vote due to "+re);
return false;
}
}