unit.putAttachment(JobSchedulerMetaData.ATTACHMENT_KEY, schedulerMetaData);
}
log.debugf("Setting job scheduler concurrency to %s", schedulerMetaData.getThreadCount());
JobScheduler scheduler = new JobScheduler(serviceName.getCanonicalName(), schedulerMetaData.getThreadCount());
ServiceBuilder<BaseJobScheduler> builder = phaseContext.getServiceTarget().addService(serviceName, scheduler);
// Add dependency to the jobs pool
builder.addDependency(CoreServices.runtimePoolName(unit, "jobs"), RubyRuntimePool.class, scheduler.getRubyRuntimePoolInjector());
if (singleton) {
// A singleton scheduler needs to depend on a HA Singleton
builder.addDependency(HASingleton.serviceName(unit, "global"));
// Come up only when the deps are satisfied (in this case HA Singleton)