Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Invalid
-
1.6.0
-
None
-
None
-
Windows 7 x64, jdk1.6.0_45 64 bits
Description
This component:
@Singleton
@Startup
public class SendSubscriptionsTimer {
@Inject
private Logger logger;
@Resource
private TimerService timerService;
@PostConstruct
private void systemStartup()
@Resource
private TransactionSynchronizationRegistry tx;
@Timeout
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
private void timerFired() {
logger.info("TIMER START");
logger.info("Transaction: {}", tx.getTransactionKey().toString());
}
}
logs:
INFO 2014-02-14 13:46:00,025 TIMER START
INFO 2014-02-14 13:46:00,026 Transaction: [Xid:globalId=5000000047544d4944000000000000000000000000000000000000000000000000000,length=64,branchId=0000000000000000000000000000000000000000000000000000000000000000,length=64]
Additionally, if this timerFired method performs some lengthy task (in my case duration is 30 minutes), I get this:
2014-02-14 06.22.41 org.apache.openejb.core.timer.EjbTimerServiceImpl ejbTimeout
WARNING: Exception occured while completing container transaction
javax.transaction.RollbackException: Unable to commit: transaction marked for rollback
at org.apache.geronimo.transaction.manager.TransactionImpl.commit(TransactionImpl.java:272)
at org.apache.geronimo.transaction.manager.TransactionManagerImpl.commit(TransactionManagerImpl.java:252)
at org.apache.openejb.core.timer.EjbTimerServiceImpl.ejbTimeout(EjbTimerServiceImpl.java:801)
at org.apache.openejb.core.timer.EjbTimeoutJob.execute(EjbTimeoutJob.java:39)
at org.quartz.core.JobRunShell.run(JobRunShell.java:207)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.Exception: Transaction has timed out
at org.apache.geronimo.transaction.manager.TransactionImpl.commit(TransactionImpl.java:266)
... 7 more
As a result, the @Timeout method gets called the second time (per EJB spec: if exception is thrown, server must retry at least once).