in src/main/java/org/apache/sling/discovery/impl/cluster/voting/VotingHelper.java [119:152]
public static List<VotingView> listTimedoutVotings(
final ResourceResolver resourceResolver, final Config config) {
final String ongoingVotingsPath = config.getOngoingVotingsPath();
final Resource ongoingVotingsResource = resourceResolver
.getResource(ongoingVotingsPath);
if (ongoingVotingsResource == null) {
logger.info("listTimedoutVotings: no ongoing votings parent resource found"); // TOOD - is this expected?
return new ArrayList<VotingView>();
}
final Iterable<Resource> children = ongoingVotingsResource.getChildren();
final Iterator<Resource> it = children.iterator();
final List<VotingView> result = new LinkedList<VotingView>();
if (!it.hasNext()) {
return result;
}
while (it.hasNext()) {
Resource aChild = it.next();
VotingView c = new VotingView(aChild);
if (c.isTimedoutVoting(config)) {
if (logger.isDebugEnabled()) {
logger.debug("listTimedoutVotings: found a timed-out voting: "
+ aChild
+ ", properties="
+ ResourceHelper.getPropertiesForLogging(aChild));
}
result.add(c);
}
}
if (logger.isDebugEnabled()) {
logger.debug("listTimedoutVotings: votings found: "
+ result.size());
}
return result;
}