On 4.0.4.GA (w/ EJB RC7), when I get a deadlock, I end up with the following 
exception hierarchy:


  | javax.ejb.EJBTransactionRolledbackException
  | javax.ejb.EJBException
  | javax.persistence.PersistenceException
  | org.hibernate.exception.LockAcquisitionException: could not insert: ...
  | java.sql.SQLException: Deadlock found when trying to get lock; try 
restarting transaction 

Is there a cleaner way to detect this than simply walking down the exception 
list until an "SQLException" with the desired error code is found?

Secondly, I would like an automatic deadlock handler which retries TX's that 
end in deadlocks automatically while still using CMT (container managed 
transactions).

There seems to be a jboss extention for this: 
org.jboss.ejb.plugins.TxRetryExceptionHandler: 
http://wiki.jboss.org/wiki/Wiki.jsp?page=RetryingTransactions

However this does not allow me to easily keep track of any state regarding the 
retry (ie: retry count numbers, data for back off algorithms, etc.)

I can use the EJB3 Interceptor spec, but this ties in *after* the transaction 
management stuff has been setup.  I really would want to intercept before the 
transaction information is setup, but this would require using the jboss aop 
stuff I think.

Any thoughts on the cleanest way to implement an automatic TX retry handler on 
deadlocks while still using CMTs?

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3956275#3956275

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3956275

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to