[jboss-user] Problems with TimerBean and transaction-rollback

frusso at email.it frusso at email.it
Wed Aug 27 17:59:23 EDT 2008

Hi everybody,
I'm working with JBoss 5 CR 1 playing around with a Timer Bean. Here  
are some details:
- the Timer's time-out method is marked with a RequiresNew TX-attribute
- the timeout I create is a one-shot timer (it has to be executed  
exactly once)

The Timer Bean's timeout code resembles what follows:

public void foo(Timer timer) {
   try {
     if(accessDataStore()) {
     } else {
   } catch(DataStoreException e) {

What upsets me is that whenever the guard of the if statement throws a  
DataStoreException, the setRollbackOnly() method is called but the  
timer does not get rescheduled: querying the PUBLIC.TIMERS table of  
the JBoss Hypersonic internal DB, I can see no timer is scheduled  
anymore. This does not sound appropriate to me due to what the JEE 5  
spec states:

"If the timer is a single-action timer, the container removes the  
timer after the timeout callback method
has been successfully invoked (e.g., when the transaction that has  
been started for the invocation of the
timeout callback method commits)." (JSR 220 - EJB Core Contracts and  
Requirements v 3.0 Final Release - Section 18.2.2)

I've temporarily solved the problem creating a repetitive-timer and  
canceling it if and only if the timeout method succeeds, but I feel  
like the right approach was the former one.

Any help is appreciated.

Thanks in advance,
Francesco Russo

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20080827/24ace47f/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1613 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/jboss-user/attachments/20080827/24ace47f/attachment.bin 

More information about the jboss-user mailing list