简体   繁体   中英

Programmatic Timer @Timeout executes several times

I have a non-persistent programmatic timer. When the execution is more than 600 seconds, the @Timeout method is launched twice. However if the execution is smaller than 600 seconds it only executes one time.(this is what I need).

Anybody knows what's happening?

How can I solve this problem in order for the timer to only execute one time?

Regards

I have already found a way to fix it. Is putting the annotation @timeout the annotations @TransactionAttribute and @TransactionTimeout:

@Timeout
@TransactionAttribute (TransactionAttributeType.REQUIRES_NEW)
@TransactionTimeout (value = 1, unit = TimeUnit.HOURS)

To have those dependencies put in the pom

<dependency>
         <groupId> org.jboss.ejb3 </ groupId>
         <artifactId> jboss-ejb3-ext-api </ artifactId>
         <version> 2.2.0.Final </ version>
   </ dependency>

I help you with these questions: wildfly 10 final: Error invoking timeout for timer (it's for @schedule but it applies the same thing).

https://developer.jboss.org/thread/248773?_sscc=t

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM