i have
@Stateless
public class TimerMonitoraggioDatabase {
@Schedule(hour="5", minute="10", dayOfWeek="Mon-Fri",
dayOfMonth="*", month="*", year="*", info="MyTimer", persistent=false)
private void scheduledTimeout(final Timer t) {
but if the activity exceeds 10 minutes, i have this error (first problem):
2017-03-20 05:20:51,097 WARN [com.arjuna.ats.arjuna] (EJB default -
1) ARJUNA012077: Abort called on already aborted atomic action
0:ffff0a93a0e9:-c2465a:58cbcab4:37e3 2017-03-20 05:20:51,099 ERROR
[org.jboss.as.ejb3.timer] (EJB default - 1) WFLYEJB0020: Error
invoking timeout for timer: [id=e2ecbbbf-f339-431d-a031-4f02ea8f67fb
timedObjectId=Utopia-ear.Utopia-ejb.TimerMonitoraggioDatabase
auto-timer?:true persistent?:false
timerService=org.jboss.as.ejb3.timerservice.TimerServiceImpl@188c2824
initialExpiration=null intervalDuration(in milli sec)=0
nextExpiration=Tue Mar 21 05:10:00 CET 2017 timerState=IN_TIMEOUT
info=MyTimer]: javax.ejb.EJBTransactionRolledbackException:
Transaction rolled back
at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleEndTransactionException(CMTTxInterceptor.java:137)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.endTransaction(CMTTxInterceptor.java:117)
and then starts the timer again (second problem ?) without throw the excption at the end of 10 minutes
I did have the same problem with Wildfly 10.
Since @Schedule is just a short and easy way to package an implicit EJB Timer with a @Timeout method, all other EJB Timer restrictions apply.
I am no expert on EJB, but it seems that there is a default timeout, when the @Schedule method is expected to finish - which seems quite short (i.e. mere minutes).
Additionally - from empirical evidence - it looks like if the timout is reached, it tries to trigger the method again (hence the second run after the first terminates).
I read that you can configure the default timeout directly in JBoss, but this was no option for me - so I did not persue this lead (JBoss transaction timeout setting?).
What I did was setting the timeout for the @Schedule method manually.
Since Wildfly 10 is using EJB3 as default, make sure that you use the EJB3 version of the TransactionTimeout annotation.
If not already implicit, please add the following to your pom.xml:
<dependency>
<groupId>org.jboss.ejb3</groupId>
<artifactId>jboss-ejb3-ext-api</artifactId>
<version>2.2.0.Final</version>
<scope>provided</scope>
</dependency>
Now you can set a timout just for your @Schedule method, like:
import org.jboss.ejb3.annotation.TransactionTimeout:
@Schedule(hour="5", minute="10", dayOfWeek="Mon-Fri",
dayOfMonth="*", month="*", year="*", info="MyTimer", persistent=false)
@TransactionTimeout(value = 23, unit = TimeUnit.HOURS)
private void scheduledTimeout(final Timer t) {