@Timeout public void execute(Timer timer) { try { if (timer.getTimeRemaining() < 0) { logger.info("Skipping missed job timeout with id {}", timer.getInfo()); return; } } catch (NoMoreTimeoutsException e) { } Job job = em.find(Job.class, timer.getInfo()); if (job == null) { logger.info("Job with id {} not found. Cancelling...", timer.getInfo()); timer.cancel(); } else if (!job.isActivate()) { logger.info("Skipping execution of job {} because it is marked as inactive.", timer.getInfo()); } else { JobExecution execution = executor.createExecution(job); executor.execute(execution, job); } }
public long getTimeRemaining() throws IllegalStateException, NoSuchObjectLocalException { checkState(); final Date nextTimeout = timerData.getNextTimeout(); if (nextTimeout == null) { throw new NoMoreTimeoutsException("The timer has no future timeouts"); } return timerData.getTimeRemaining(); }
public Date getNextTimeout() throws IllegalStateException, NoSuchObjectLocalException { checkState(); final Date nextTimeout = timerData.getNextTimeout(); if (nextTimeout == null) { throw new NoMoreTimeoutsException("The timer has no future timeouts"); } return timerData.getNextTimeout(); }
@Override public long getTimeRemaining() throws IllegalStateException, NoSuchObjectLocalException, NoMoreTimeoutsException, EJBException { return ZERO_TIME; }
@Override public Date getNextTimeout() throws IllegalStateException, NoSuchObjectLocalException, NoMoreTimeoutsException, EJBException { return nextTimeout; }