-
1. Re: How to detect transaction timeout ?
jhalliday Jun 1, 2007 10:47 AM (in response to davidbalazic)I'm guessing that you are using EJB3 and the JBAS-1509 feature is only in the EJB2 container. However, the <exception-on-rollback> is the best (only) approach if the client does not manage (begin/commit/rollback) the transaction. Turn on TRACE level logging and see if the TxInterceptorCMT is working - according to the JIRA issue that is the code which implements the feature. If it's not firing, raise a new JIRA issue to have this behaviour fixed.
-
2. Re: How to detect transaction timeout ?
davidbalazic Jun 2, 2007 4:59 AM (in response to davidbalazic)As the bean code is full of annotations, I guess it is EJB3 :-)
How can I check for sure whether it is EJB2 or EJB3 ? -
3. Re: How to detect transaction timeout ?
davidbalazic Jun 4, 2007 5:47 AM (in response to davidbalazic)I added to the log4j.xml these lines :
but there is nothing in the log from TxInterceptorCMT. (there are a few other unrelated TRACE lines). -
4. Re: How to detect transaction timeout ?
davidbalazic Jun 4, 2007 5:48 AM (in response to davidbalazic)The forum ate my code :
<category name="org.jboss.ejb"> <priority value="TRACE" class="org.jboss.logging.XLevel"/>
-
5. Re: How to detect transaction timeout ?
davidbalazic Jul 16, 2007 11:31 AM (in response to davidbalazic)OK, I found out that I can detect the timeout with SessionContext.getRollbackOnly(), like this :
@Resource SessionContext ctx; // and then check at the end of each business (public) method : if (ctx.getRollbackOnly()) { throw new Some...Exception("Something happened, method failed"); } return result; // otherwise end normally
But adding that check to each method is really ugly. Is there no simpler method ?