From a69147177484039f9eb864aeeff92b12f54b56ac Mon Sep 17 00:00:00 2001 From: erik Date: Mon, 24 Mar 2008 11:18:53 +0000 Subject: [PATCH] Timers appear to be persistent in glassfish so now canceling any old itmers before starting the new one. --- mythtv/timer/src/main/java/org/wamblee/timer/TimerBean.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mythtv/timer/src/main/java/org/wamblee/timer/TimerBean.java b/mythtv/timer/src/main/java/org/wamblee/timer/TimerBean.java index 048e94b5..fffd74b8 100644 --- a/mythtv/timer/src/main/java/org/wamblee/timer/TimerBean.java +++ b/mythtv/timer/src/main/java/org/wamblee/timer/TimerBean.java @@ -16,6 +16,8 @@ package org.wamblee.timer; +import java.util.Collection; + import javax.annotation.Resource; import javax.ejb.MessageDriven; import javax.ejb.Timeout; @@ -59,6 +61,10 @@ public class TimerBean implements MessageListener { try { int interval = (Integer)msg.getObject(); LOG.info("Initializing timer with interval " + interval + " seconds"); + for (Timer timer: (Collection)_timerService.getTimers()) { + LOG.info("Canceling old timers: " + timer); + timer.cancel(); + } _timerService.createTimer(1000, interval*1000, null); } catch (JMSException e) { throw new RuntimeException(e.getMessage()); -- 2.31.1