Search in sources :

Example 1 with InternalSchedulerService

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;
}
Also used : TimerJobInstance(org.drools.core.time.impl.TimerJobInstance) InternalSchedulerService(org.drools.core.time.InternalSchedulerService) AtomicLong(java.util.concurrent.atomic.AtomicLong)

Aggregations

AtomicLong (java.util.concurrent.atomic.AtomicLong)1 InternalSchedulerService (org.drools.core.time.InternalSchedulerService)1 TimerJobInstance (org.drools.core.time.impl.TimerJobInstance)1