@Override public void setTimerJobFactoryManager( TimerJobFactoryManager timerJobFactoryManager) { timerService.setTimerJobFactoryManager(timerJobFactoryManager); }
@Override public void reset() { timerService.reset(); } }
@Override public long getCurrentTime() { return timerService.getCurrentTime(); }
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 long getSessionId() { if (this.getTimerJobInstance() != null) { JobContext ctx = this.getTimerJobInstance().getJobContext(); if (ctx instanceof SelfRemovalJobContext) { ctx = ((SelfRemovalJobContext) ctx).getJobContext(); } if (ctx instanceof ProcessJobContext) { return ((ProcessJobContext)ctx).getSessionId(); } } return -1; }
private long resolveValue(String s) { return TimeUtils.parseTimeString(s); } }
@Override public void afterCompletion(int status) { if ( status == TransactionManager.STATUS_COMMITTED && !timerJobInstance.getJobHandle().isCancel()) { this.schedulerService.internalSchedule(timerJobInstance); } }
@Override public TimerJobFactoryManager getTimerJobFactoryManager() { return timerService.getTimerJobFactoryManager(); }
@Override public JobHandle scheduleJob(Job job, JobContext ctx, Trigger trigger) { return timerService.scheduleJob(job, ctx, trigger); }
@Override public boolean removeJob(JobHandle jobHandle) { return timerService.removeJob(jobHandle); }
@Override public void shutdown() { timerService.shutdown(); }
public Date nextFireTime() { return orig.nextFireTime(); }
@Override public void internalSchedule(TimerJobInstance timerJobInstance) { ((InternalSchedulerService)timerService).internalSchedule(timerJobInstance); }
@Override public long getTimeToNextJob() { return timerService.getTimeToNextJob(); }
@Override public Collection<TimerJobInstance> getTimerJobInstances(long id) { return timerService.getTimerJobInstances(id); }
private long resolveValue(String s) { try { return TimeUtils.parseTimeString(s); } catch (RuntimeException e) { s = resolveVariable(s); return TimeUtils.parseTimeString(s); } }
public void cancelTimer(long timerId) { try { kruntime.startOperation(); TimerInstance timer = timers.remove(timerId); if (timer != null) { timerService.removeJob(timer.getJobHandle()); } } finally { kruntime.endOperation(); } }
@Override public void internalSchedule(TimerJobInstance timerJobInstance) { if (this.schedulerService instanceof InternalSchedulerService) { ((InternalSchedulerService) this.schedulerService).internalSchedule(timerJobInstance); } else { throw new UnsupportedOperationException("Unsupported scheduler operation internalSchedule on class " + this.schedulerService.getClass()); } }
public static long parseDateAsDuration(String dateTimeStr) { try { OffsetDateTime dateTime = OffsetDateTime.parse(dateTimeStr, DateTimeFormatter.ISO_DATE_TIME); Duration duration = Duration.between(OffsetDateTime.now(), dateTime); return duration.toMillis(); } catch (Exception e) { return TimeUtils.parseTimeString(dateTimeStr); } }
public static long parseDuration(String durationStr) { if (isPeriod(durationStr)) { return Duration.parse(durationStr).toMillis(); } else { return TimeUtils.parseTimeString(durationStr); } }