<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi everybody,<div>I'm working with JBoss 5 CR 1 playing around with a Timer Bean. Here are some details:&nbsp;</div><div>- the Timer's time-out method is marked with a RequiresNew TX-attribute</div><div>- the timeout I create is a one-shot timer (it has to be executed exactly once)</div><div><br></div><div>The Timer Bean's timeout code resembles what follows:&nbsp;</div><div><br></div><div><div>@Timeout</div><div>@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)</div><div>public void foo(Timer timer) {</div><div>&nbsp;&nbsp;try {</div><div>&nbsp;&nbsp; &nbsp;if(accessDataStore()) {</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>...<br></div><div>&nbsp;&nbsp; &nbsp;} else {</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>...<br></div><div>&nbsp;&nbsp; &nbsp;}</div><div>&nbsp;&nbsp;} catch(DataStoreException e) {</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>sessionCtx.setRollbackOnly();</div><div>&nbsp;&nbsp;}</div><div>}</div><div><br></div><div>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:</div><div><br></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 13px;">"If the timer is a single-action timer, the container removes the timer after the timeout callback method</span></font><span style="font: 12.0px Helvetica"><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 13px;">&nbsp;</span></font></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Times; "><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 13px;">has been successfully invoked (e.g., when the transaction that has been started for the invocation of the</span></font><span style="font: 12.0px Helvetica"><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 13px;">&nbsp;</span></font></span></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 13px;">timeout callback method commits)." (JSR 220 - EJB Core Contracts and Requirements v 3.0 Final Release - Section 18.2.2)</span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 13px;"><br></span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 13px;">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.</span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 13px;"><br></span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 13px;">Any help is appreciated.</span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 13px;"><br></span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 13px;">Thanks in advance,</span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 13px;">Francesco Russo</span></font></div></div></body></html>