in src/main/java/org/apache/sling/commons/scheduler/impl/WhiteboardHandler.java [249:276]
private void scheduleJob(final ServiceReference<?> ref, final Object job, final ScheduleOptions scheduleOptions) {
final String name = getServiceIdentifier(ref);
final Boolean concurrent = getBooleanProperty(ref, Scheduler.PROPERTY_SCHEDULER_CONCURRENT);
final String[] runOnOpts = getRunOpts(ref);
final Object poolNameObj = ref.getProperty(Scheduler.PROPERTY_SCHEDULER_THREAD_POOL);
final String poolName;
if ( poolNameObj != null && poolNameObj.toString().trim().length() > 0 ) {
poolName = poolNameObj.toString().trim();
} else {
poolName = null;
}
final ScheduleOptions options = scheduleOptions
.name(name)
.canRunConcurrently((concurrent != null ? concurrent : true))
.threadPoolName(poolName)
.onInstancesOnly(runOnOpts);
((InternalScheduleOptions)scheduleOptions).providedName = getStringProperty(ref, Scheduler.PROPERTY_SCHEDULER_NAME);
final long bundleId = ref.getBundle().getBundleId();
final Long serviceId = getLongProperty(ref, Constants.SERVICE_ID);
if ( this.scheduler.schedule(bundleId, serviceId, job, options) ) {
this.idToNameMap.put(serviceId, name);
} else {
logger.error("Scheduling Runnable service {} failed.", job.getClass().getName());
}
}