public Collection<Timer> getAllActiveTimers() { final Collection<Timer> activeTimers = new HashSet<>(); synchronized (timerServices) { for (final TimerService timerService : timerServices) { activeTimers.addAll(timerService.getTimers()); } } return activeTimers; } }
public static void addTimers(final EJBComponent ejb, final ModelNode response) { response.setEmptyList(); final String name = ejb.getComponentName(); TimerService ts = ejb.getTimerService(); if (ts != null) { for (Timer timer : ts.getTimers()) { ModelNode timerNode = response.add(); addTimeRemaining(timer, timerNode, name); addNextTimeout(timer, timerNode, name); addCalendarTimer(timer, timerNode, name); addPersistent(timer, timerNode, name); addSchedule(timer, timerNode, name); } } }
@Resource private TimerService timerService; @PostConstruct void startup() { ... for (Timer timer: timerService.getTimers()) { timer.cancel(); } ... }
TimerService timerService = sessionContext.getTimerService(); for (Timer timer : timerService.getTimers()) { timer.cancel(); //etc. }
public void removeAllTimers() { logger.info("Removing ALL existing timers."); int i = 0; for (Iterator it = timerService.getTimers().iterator(); it.hasNext();) { Timer timer = (Timer) it.next(); logger.info("Removing timer " + i + ";"); timer.cancel(); i++; } logger.info("Done!"); }
public Collection<Timer> getTimers() throws IllegalStateException, EJBException { assertAllowedIn("TimerService.getTimers"); return delegate.getTimers(); } }
private Timer getImportTimer() { for (Object obj : timerService.getTimers()) { Timer timer = (Timer) obj; String scheduled = (String) timer.getInfo(); if (scheduled.equals(Constante.IMPORT_TIMER_NAME)) { return timer; } } return null; }
public Collection<Timer> getTimers() throws IllegalStateException, EJBException { assertAllowedIn("TimerService.getTimers"); return timerService.getTimers(); }
public Collection<Timer> getTimers() throws IllegalStateException, EJBException { assertAllowedIn("TimerService.getTimers"); return timerService.getTimers(); }
public Collection<Timer> getTimers() throws IllegalStateException, EJBException { assertAllowedIn("TimerService.getTimers"); return timerService.getTimers(); }
/** * @return Returns true if snapshot is running. */ @RolesAllowed("mejbuser") public boolean isSnapshotRunning() { Collection<Timer> timers = timer.getTimers(); // if there are timers there is something running to collect snapshots if(timers.size() > 0) { return true; } else { return false; } }
/** * Cancel all timers. */ @SuppressWarnings("unchecked") private void cancelAllTimers() { Collection<Timer> timers = timerService.getTimers(); for (Iterator<Timer> it = timers.iterator(); it.hasNext();) { Timer timer = it.next(); timer.cancel(); } timers.clear(); }
public Collection<Timer> getTimers() throws IllegalStateException, EJBException { return getTimerService().getTimers(); }
/** * Gets the timer. * * @return the timer. */ public Timer getTimer() { Collection<Timer> timers = timerService.getTimers(); for (Timer timer : timers) { if (TIMER_INFO.equals(timer.getInfo())) { return timer; } } return null; }
@PostConstruct public void startScheduler() { TimerService timerService = sessionContext.getTimerService(); logger.info("Current running timers: {}", timerService.getTimers().toString()); for (Timer t : timerService.getTimers()) { t.cancel(); logger.info("killed the timer service: {}", t); } TimerConfig timerConfig = new TimerConfig(); timerConfig.setPersistent(false); Timer createdIntervalTimer = sessionContext.getTimerService().createIntervalTimer(0, 5000, timerConfig); logger.info("Created new Timer: {}", createdIntervalTimer); }
public Collection<Timer> getTimers() throws IllegalStateException, EJBException { return getTimerService().getTimers(); }
public List<HarvestTimerInfo> getHarvestTimers() { ArrayList <HarvestTimerInfo>timers = new ArrayList<>(); for (Iterator it = timerService.getTimers().iterator(); it.hasNext();) { Timer timer = (Timer) it.next(); if (timer.getInfo() instanceof HarvestTimerInfo) { HarvestTimerInfo info = (HarvestTimerInfo) timer.getInfo(); timers.add(info); } } return timers; }
/** * @see javax.ejb.TimerService#getTimers() */ public Collection getTimers() throws IllegalStateException, EJBException { // Not allowed when called from ejbCreate if (getState() < 2) { throw new IllegalStateException("the instance is not allowed to call this method"); } return getTimerService().getTimers(); }
public void cancelTimers() { Collection<Timer> timers = this.timerService.getTimers(); for (Timer timer : timers) { if (timer.getInfo() != null) { if (timer.getInfo().equals(TIMER_ID)) { timer.cancel(); LOG.debug("cancel timer: " + TIMER_ID); } } } }
/** * {@inheritDoc} */ public void cancelTimers(String timerInfo) { Collection<Timer> timers = this.timerService.getTimers(); for (Timer timer : timers) { if (timer.getInfo() != null) { if (timer.getInfo().equals(timerInfo)) { timer.cancel(); LOG.debug("cancel timer: " + timerInfo); } } } }