import javax.ejb.Timeout;
import javax.ejb.Timer;
import javax.ejb.TimerService;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.ejb.TransactionManagement;
+import javax.ejb.TransactionManagementType;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
/**
*
*/
-@MessageDriven(mappedName = "jms/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)
public class TimerBean implements MessageListener {
private static final Log LOG = LogFactory.getLog(TimerBean.class);
try {
int interval = (Integer)msg.getObject();
LOG.info("Initializing timer with interval " + interval + " seconds");
- _timerService.createTimer(interval*1000, interval*1000, null);
+ _timerService.createTimer(1000, interval*1000, null);
} catch (JMSException e) {
throw new RuntimeException(e.getMessage());
}
@Timeout
private void timeout(Timer aTimer) {
- LOG.debug("Timer expired!!!");
+ LOG.info("Timer expired!!!");
try {
DirectoryMonitor monitor = BeanKernel.getBeanFactory().find(
DirectoryMonitor.class);