in src/main/java/org/apache/sling/jobs/impl/JobSubsystem.java [151:163]
public void execute(@NotNull Job initialState, @NotNull JobUpdateListener listener, @NotNull JobCallback callback) {
// iterate over the entries. This should cause the entries to come out in natural key order
// which should respect any priority applied to the Services via ServiceReference. (TODO: check that is the case)
// TODO: add a Job controller to the job before executing.
for (Map.Entry<ServiceReference<JobConsumer>,JobConsumerHolder> e : registrations.entrySet()) {
JobConsumerHolder jobConsumerHolder = e.getValue();
if (jobConsumerHolder.accept(initialState.getJobType())) {
jobConsumerHolder.consumer.execute(initialState, listener, callback);
return;
}
}
throw new IllegalArgumentException("No JobConsumer able to process a job of type "+initialState.getJobType()+" can be found in this instance.");
}