in src/main/java/org/apache/sling/event/impl/jobs/queues/QueueJobCache.java [249:271]
private void orderTopics(final Map<String, List<JobImpl>> topicCache) {
if ( this.queueType == Type.ORDERED
|| this.queueType == Type.UNORDERED) {
for(final List<JobImpl> list : topicCache.values()) {
this.cache.addAll(list);
}
Collections.sort(this.cache);
} else {
// topic round robin
boolean done = true;
do {
done = true;
for(final Map.Entry<String, List<JobImpl>> entry : topicCache.entrySet()) {
if ( !entry.getValue().isEmpty() ) {
this.cache.add(entry.getValue().remove(0));
if ( !entry.getValue().isEmpty() ) {
done = false;
}
}
}
} while ( !done ) ;
}
}