public Timer createSingleActionTimer(long duration, TimerConfig timerConfig) throws IllegalArgumentException, IllegalStateException, EJBException { assertAllowedIn("TimerService.createSingleActionTimer"); return timerService.createSingleActionTimer(duration, timerConfig); }
public Timer createSingleActionTimer(Date expiration, TimerConfig timerConfig) throws IllegalArgumentException, IllegalStateException, EJBException { assertAllowedIn("TimerService.createSingleActionTimer"); return timerService.createSingleActionTimer(expiration, timerConfig); }
public Timer createSingleActionTimer(long duration, TimerConfig timerConfig) throws IllegalArgumentException, IllegalStateException, EJBException { assertAllowedIn("TimerService.createSingleActionTimer"); return timerService.createSingleActionTimer(duration, timerConfig); }
public Timer createSingleActionTimer(Date expiration, TimerConfig timerConfig) throws IllegalArgumentException, IllegalStateException, EJBException { assertAllowedIn("TimerService.createSingleActionTimer"); return delegate.createSingleActionTimer(expiration, timerConfig); }
@Stateless // or @Singleton public class MyTimerEJB { @Resource private TimerService timerService; @Timeout public void existingTimeoutMethod() { ... } public void fireTimeoutAsynchronouslyAlmostImmediately() { timerService.createSingleActionTimer(10, new TimerConfig(null, false)); } }
public Timer createSingleActionTimer(Date expiration, TimerConfig timerConfig) throws IllegalArgumentException, IllegalStateException, EJBException { assertAllowedIn("TimerService.createSingleActionTimer"); return timerService.createSingleActionTimer(expiration, timerConfig); }
public Timer createSingleActionTimer(Date expiration, TimerConfig timerConfig) throws IllegalArgumentException, IllegalStateException, EJBException { assertAllowedIn("TimerService.createSingleActionTimer"); return timerService.createSingleActionTimer(expiration, timerConfig); }
public Timer createSingleActionTimer(long duration, TimerConfig timerConfig) throws IllegalArgumentException, IllegalStateException, EJBException { assertAllowedIn("TimerService.createSingleActionTimer"); return timerService.createSingleActionTimer(duration, timerConfig); }
public Timer createSingleActionTimer(long duration, TimerConfig timerConfig) throws IllegalArgumentException, IllegalStateException, EJBException { assertAllowedIn("TimerService.createSingleActionTimer"); return delegate.createSingleActionTimer(duration, timerConfig); }
public Timer createSingleActionTimer(final Date date, final TimerConfig timerConfig) throws IllegalArgumentException, IllegalStateException, EJBException { return getTimerService().createSingleActionTimer(date, timerConfig); }
public Timer createSingleActionTimer(final long l, final TimerConfig timerConfig) throws IllegalArgumentException, IllegalStateException, EJBException { return getTimerService().createSingleActionTimer(l, timerConfig); }
public Timer createSingleActionTimer(final long l, final TimerConfig timerConfig) throws IllegalArgumentException, IllegalStateException, EJBException { return getTimerService().createSingleActionTimer(l, timerConfig); }
public Timer createSingleActionTimer(final Date date, final TimerConfig timerConfig) throws IllegalArgumentException, IllegalStateException, EJBException { return getTimerService().createSingleActionTimer(date, timerConfig); }
@Startup @Singleton public class SomeTimerBean { @Resource private TimerService timerService; @Postconstruct public void init() { timerService.createSingleActionTimer(0, new TimerConfig(null, false)); } @Timeout public void doStuff(Timer timer) { // ... } }
@Stateless public class AutomaticResponseSender { private static final Integer _5_MINS = 300000; @Resource private TimerService timerService; public void waitFiveMinutes() { Timer nextTimer = timerService.createSingleActionTimer(_5_MINS, null); } @Timeout public void autoRespondForNotAnswered() { // here send an auto response } public void cancel() { timerService.cancel(); } }
public void start() { TimerConfig config = new TimerConfig(); config.setPersistent(false); timerService.createSingleActionTimer(100, config); }
@Override @TransactionAttribute(TransactionAttributeType.NEVER) public void scheduleAvailabilityDurationCheck(AvailabilityDurationCacheElement cacheElement, Resource resource, long startTime) { String operator = cacheElement.getAlertConditionOperator().name(); String durationString = (String) cacheElement.getAlertConditionOperatorOption(); long duration = Long.valueOf(durationString).longValue() * 1000; if (log.isDebugEnabled()) { Date jobTime = new Date(System.currentTimeMillis() + duration); log.debug("Scheduling availability duration job for [" + DateFormat.getDateTimeInstance().format(jobTime) + "]"); } HashMap<String, String> infoMap = new HashMap<String, String>(); // the condition id is needed to ensure we limit the future avail checking to the one relevant alert condition infoMap.put(AlertAvailabilityDurationJob.DATAMAP_CONDITION_ID, String.valueOf(cacheElement.getAlertConditionTriggerId())); infoMap.put(AlertAvailabilityDurationJob.DATAMAP_RESOURCE_ID, String.valueOf(resource.getId())); infoMap.put(AlertAvailabilityDurationJob.DATAMAP_OPERATOR, operator); infoMap.put(AlertAvailabilityDurationJob.DATAMAP_DURATION, durationString); // in seconds infoMap.put(AlertAvailabilityDurationJob.DATAMAP_START_TIME, String.valueOf(startTime)); // in milliseconds timerService.createSingleActionTimer(duration, new TimerConfig(infoMap, false)); }
public void internalSchedule(TimerJobInstance timerJobInstance) { TimerConfig config = new TimerConfig(new EjbTimerJob(timerJobInstance), true); Date expirationTime = timerJobInstance.getTrigger().hasNextFireTime(); logger.debug("Timer expiration date is {}", expirationTime); if (expirationTime != null) { timerService.createSingleActionTimer(expirationTime, config); logger.debug("Timer scheduled {} on {} scheduler service", timerJobInstance); localCache.putIfAbsent(((EjbGlobalJobHandle) timerJobInstance.getJobHandle()).getUuid(), timerJobInstance); } else { logger.info("Timer that was to be scheduled has already expired"); } }
/** * Schedule a job for a single execution, at the given date. * <p/> * @param job * @param when */ public void scheduleJobOnce(Jobs job, Date when) { TimerConfig config = new TimerConfig(); config.setInfo(job.getId()); timerService.createSingleActionTimer(when, config); }
/** * {@inheritDoc} */ public void startTimerNow(TrustPointEntity trustPoint) { TimerConfig timerConfig = new TimerConfig(); timerConfig.setInfo(trustPoint.getName()); timerConfig.setPersistent(false); Timer timer = this.timerService.createSingleActionTimer(1000 * 10, timerConfig); LOG.debug("created single action timer for trustpoint " + trustPoint.getName() + " at " + timer.getNextTimeout().toString()); }