I was thinking about this over the weekend.
The best way to fix this would be to implement the XAResource wrapper
that we have been talking about for JCA.
We could then check whether the connection is closed in end()
and also reinstate the old behaviour for a failure (i.e. log a warning).
This would also require some form of xid/transaction mapping
which I'm not sure how we do generically - probably some trick
in the tx.enlistResource() call which will callback on our XAResource wrapper
with the XID?
e.g. Something like:
| public void end(Xid xid, int flags) throws XAException
| {
| // Ignore if we are already destroyed
| if (cl.getState() == ConnectionListener.DESTROYED)
| return;
|
| try
| {
| delegate.end(xid, flags);
| }
| catch (Throwable t)
| {
| // We log the warning and force a rollback
| log.warn("Error ending resource " + cl, t);
| try
| {
| Transaction tx = getTransaction(xid); // ?????
| if (TxUtils.isActive(tx))
| tx.setRollbackOnly();
| }
| catch (Throwable t)
| {
| log.warn("Unable to setRollbackOnly " + xid, t);
| }
| }
| }
|
Similar already destroyed checks would also be possible
in the other calls (e.g. prepare/commit), except there we want to raise an XAException.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4007751#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...