JBoss.org Community Documentation
Since JBoss can detect application deadlock, you should write your application so that it can retry a transaction if the invocation fails because of the ApplicationDeadlockException. Unfortunately, this exception can be deeply embedded within a RemoteException, so you have to search for it in your catch block. For example:
try {
// ...
} catch (RemoteException ex) {
Throwable cause = null;
RemoteException rex = ex;
while (rex.detail != null) {
cause = rex.detail;
if (cause instanceof ApplicationDeadlockException) {
// ... We have deadlock, force a retry of the transaction.
break;
}
if (cause instanceof RemoteException) {
rex = (RemoteException)cause;
}
}
}