You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "Romain Manni-Bucau (JIRA)" <ji...@apache.org> on 2014/02/14 13:34:19 UTC
[jira] [Commented] (TOMEE-1122) @Timeout & @TA(NOT_SUPPORTED)
methods in @Singleton beans run with transactional context
[ https://issues.apache.org/jira/browse/TOMEE-1122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13901381#comment-13901381 ]
Romain Manni-Bucau commented on TOMEE-1122:
-------------------------------------------
Hi
tested your code and can't reproduce it, after having fixed the code (to avoid NPE) I get "Transaction: null"
> @Timeout & @TA(NOT_SUPPORTED) methods in @Singleton beans run with transactional context
> ----------------------------------------------------------------------------------------
>
> Key: TOMEE-1122
> URL: https://issues.apache.org/jira/browse/TOMEE-1122
> Project: TomEE
> Issue Type: Bug
> Affects Versions: 1.6.0
> Environment: Windows 7 x64, jdk1.6.0_45 64 bits
> Reporter: Donatas Ciuksys
>
> This component:
> @Singleton
> @Startup
> public class SendSubscriptionsTimer {
> @Inject
> private Logger logger;
> @Resource
> private TimerService timerService;
> @PostConstruct
> private void systemStartup() {
> ScheduleExpression schedule = new ScheduleExpression().second("0").minute("*/1").hour("*");
> TimerConfig timerConfig = new TimerConfig();
> timerConfig.setPersistent(false);
> timerService.createCalendarTimer(schedule, timerConfig);
> }
> @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).
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)