use of org.drools.core.time.InternalSchedulerService in project jbpm by kiegroup.
the class EjbSchedulerService method scheduleJob.
@Override
public JobHandle scheduleJob(Job job, JobContext ctx, Trigger trigger) {
Long id = idCounter.getAndIncrement();
String jobName = getJobName(ctx, id);
EjbGlobalJobHandle jobHandle = new EjbGlobalJobHandle(id, jobName, ((GlobalTimerService) globalTimerService).getTimerServiceId());
TimerJobInstance jobInstance = null;
// if so skip the check by timer name as it has no way to exist
if (!isNewTimer(ctx)) {
jobInstance = scheduler.getTimerByName(jobName);
if (jobInstance != null) {
return jobInstance.getJobHandle();
}
}
jobInstance = globalTimerService.getTimerJobFactoryManager().createTimerJobInstance(job, ctx, trigger, jobHandle, (InternalSchedulerService) globalTimerService);
jobHandle.setTimerJobInstance((TimerJobInstance) jobInstance);
interceptor.internalSchedule(jobInstance);
return jobHandle;
}
Aggregations