90919293949596979899100
} Assert.assertTrue(SuspendTimerServiceBean.awaitTimerServiceCount() > 0); } finally { if (timer != null) { timer.cancel(); Thread.sleep(100); } } }
131132133134135136137138139140141
Thread.sleep(300); //if they were backed up we give them some time to run int timerServiceCount = SuspendTimerServiceBean.getTimerServiceCount(); Assert.assertTrue("Interval " + (System.currentTimeMillis() - start) + " count " + timerServiceCount, timerServiceCount < 40); } finally { if (timer != null) { timer.cancel(); Thread.sleep(100); } } }
171172173174175176177178179180181
} Assert.assertEquals(1, SuspendTimerServiceBean.awaitTimerServiceCount()); } finally { if (timer != null) { try { timer.cancel(); Thread.sleep(100); } catch(Exception e) { //as the timer has already expired this may throw an exception } }
217218219220221222223224225226227
Collection<Timer> timers = timer.getTimers(); // stop all timers boolean cancelled = false; for(Iterator<Timer> it = timers.iterator(); it.hasNext(); ) { Timer t = it.next(); t.cancel(); cancelled = true; log.info("Stopped snapshot timer..."); } return cancelled; }
3637383940414243444546
@PreDestroy public void initClear() { LOG.info("Clear Timers "); for (Object obj : timerService.getTimers()) { Timer t = (Timer) obj; t.cancel(); } } public void createTimers() { // create timer
4748495051525354555657
LOG.info("Clear Timers "); if (timerService.getTimers() != null) { LOG.info("Size: {}", timerService.getTimers().size()); for (Object obj : timerService.getTimers()) { Timer t = (Timer) obj; t.cancel(); } } } public void createTimers() {
3132333435363738394041
@PreDestroy public void initClear() { LOG.info("Clear Timers "); for (Object obj : timerService.getTimers()) { Timer t = (Timer) obj; t.cancel(); } } public void createTimers() { /**
257258259260261262263264265266267