git://wamblee.org
/
utils
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added author to all java files with class comments.
[utils]
/
trunk
/
mythtv
/
timer
/
src
/
main
/
java
/
org
/
wamblee
/
timer
/
TimerBean.java
diff --git
a/trunk/mythtv/timer/src/main/java/org/wamblee/timer/TimerBean.java
b/trunk/mythtv/timer/src/main/java/org/wamblee/timer/TimerBean.java
index ca9103017dc7dfa7a3c94ad63974123da2df3b02..5019ebd5c35136116f6b24c5e9bbff50e1db1b8b 100644
(file)
--- a/
trunk/mythtv/timer/src/main/java/org/wamblee/timer/TimerBean.java
+++ b/
trunk/mythtv/timer/src/main/java/org/wamblee/timer/TimerBean.java
@@
-16,6
+16,8
@@
package org.wamblee.timer;
package org.wamblee.timer;
+import java.util.Collection;
+
import javax.annotation.Resource;
import javax.ejb.MessageDriven;
import javax.ejb.Timeout;
import javax.annotation.Resource;
import javax.ejb.MessageDriven;
import javax.ejb.Timeout;
@@
-38,8
+40,10
@@
import org.wamblee.io.DirectoryMonitor;
/**
*
/**
*
+ *
+ * @author Erik Brakkee
*/
*/
-@MessageDriven(name = "
MythtvTimer
")
+@MessageDriven(name = "
TimerBean
")
// Spring's JTA transaction manager does not work with container managed transactions
// because it uses the UserTransaction object which glassfish forbids.
@TransactionManagement(TransactionManagementType.BEAN)
// Spring's JTA transaction manager does not work with container managed transactions
// because it uses the UserTransaction object which glassfish forbids.
@TransactionManagement(TransactionManagementType.BEAN)
@@
-59,7
+63,11
@@
public class TimerBean implements MessageListener {
try {
int interval = (Integer)msg.getObject();
LOG.info("Initializing timer with interval " + interval + " seconds");
try {
int interval = (Integer)msg.getObject();
LOG.info("Initializing timer with interval " + interval + " seconds");
- _timerService.createTimer(interval*1000, interval*1000, null);
+ for (Timer timer: (Collection<Timer>)_timerService.getTimers()) {
+ LOG.info("Canceling old timers: " + timer);
+ timer.cancel();
+ }
+ _timerService.createTimer(1000, interval*1000, null);
} catch (JMSException e) {
throw new RuntimeException(e.getMessage());
}
} catch (JMSException e) {
throw new RuntimeException(e.getMessage());
}
@@
-67,7
+75,7
@@
public class TimerBean implements MessageListener {
@Timeout
private void timeout(Timer aTimer) {
@Timeout
private void timeout(Timer aTimer) {
- LOG.
debug
("Timer expired!!!");
+ LOG.
info
("Timer expired!!!");
try {
DirectoryMonitor monitor = BeanKernel.getBeanFactory().find(
DirectoryMonitor.class);
try {
DirectoryMonitor monitor = BeanKernel.getBeanFactory().find(
DirectoryMonitor.class);