public TimerJobInstance createTimerJobInstance(Job job, JobContext ctx, Trigger trigger, JobHandle handle, InternalSchedulerService scheduler) { long sessionId = -1; if (ctx instanceof ProcessJobContext) { sessionId = ((ProcessJobContext) ctx).getSessionId(); Map<Long, TimerJobInstance> instances = timerInstances.get(sessionId); if (instances == null) { instances = new ConcurrentHashMap<Long, TimerJobInstance>(); timerInstances.put(sessionId, instances); } } ctx.setJobHandle( handle ); GlobalJpaTimerJobInstance jobInstance = new GlobalJpaTimerJobInstance( new SelfRemovalJob( job ), new SelfRemovalJobContext( ctx, emptyStore ), trigger, handle, scheduler); return jobInstance; }
public TimerJobInstance createTimerJobInstance(Job job, JobContext ctx, Trigger trigger, JobHandle handle, InternalSchedulerService scheduler) { ctx.setJobHandle( handle ); return new JpaTimerJobInstance( new SelfRemovalJob( job ), createJobContext( ctx ), trigger, handle, scheduler ); } }
public TimerJobInstance createTimerJobInstance(Job job, JobContext ctx, Trigger trigger, JobHandle handle, InternalSchedulerService scheduler) { Map<Long, TimerJobInstance> local = null; if (hasMethod(ctx.getClass(), "sessionId")) { int sessionId = getMethodIntValue(ctx, "getSessionId"); Map<Long, TimerJobInstance> instances = timerInstances.get(sessionId); if (instances == null) { instances = new ConcurrentHashMap<Long, TimerJobInstance>(); timerInstances.put(sessionId, instances); } local = timerInstances.get(sessionId); } else { local = singleTimerInstances; } ctx.setJobHandle( handle ); InfinispanTimerJobInstance jobInstance = new InfinispanTimerJobInstance( new SelfRemovalJob( job ), new SelfRemovalJobContext( ctx, local ), trigger, handle, scheduler); return jobInstance; }