Atomikos Forum |
|
Hi,
I think I found a bug in TransactionEssential (or I misundertand something ;)). When an transaction are suspended ( com.atomikos.icatch.jta.TransactionManagerImp#suspend() ) all enlisted transaction are also suspended by a call to com.atomikos.icatch.jta.TransactionImp#suspendEnlistedXaResources() -> nice. After that, if transaction are resumed ( com.atomikos.icatch.jta.TransactionManagerImp#resume(Transaction) ) enlisted xa resources are not resumed to -> IMHO it's an issue. To fix that I override TransactionManagerImp (an only that, in order to edit less code as possible, but I think TransactionImp should also be modified). My fixes for TransactionManagerImp: @Override public Transaction suspend() throws SystemException { // make sure imported txs can be suspended... this.getTransaction(); TransactionImp ret = null; CompositeTransaction ct = null; try { ct = this.ctm_.suspend(); } catch (SysException se) { String msg = "Unexpected error while suspending the existing transaction for the current thread"; Configuration.logWarning(msg, se); throw new ExtendedSystemException(msg, se.getErrors()); } if (ct != null) { ret = this.getPreviousInstance(ct.getTid()); if (ret != null) { // cf case 61305: suspend any enlisted XAResource instances ret.suspendEnlistedXaResources(); { // ------ FIX START HERE ret.setSuspendedStack(new Stack()); ret.getSuspendedStack().addAll(ret.xaresToTxMap_.values()); } // ------ FIX END HERE } } return ret; } @Override public void resume(Transaction tobj) throws InvalidTransactionException, IllegalStateException, SystemException { if (tobj == null || !(tobj instanceof TransactionImp)) { String msg = "The specified transaction object is invalid for this configuration: " + tobj; Configuration.logWarning(msg); throw new InvalidTransactionException(msg); } TransactionImp tximp = (TransactionImp) tobj; try { this.ctm_.resume(tximp.getCT()); } catch (SysException se) { String msg = "Unexpected error while resuming the transaction in the calling thread"; Configuration.logWarning(msg, se); throw new ExtendedSystemException(msg, se.getErrors()); } { // ------ FIX START HERE Iterator xaResourceTransactions = tximp.getSuspendedStack().iterator(); while (xaResourceTransactions.hasNext()) { XAResourceTransaction resTx = (XAResourceTransaction) xaResourceTransactions.next(); try { resTx.xaResume(); } catch (XAException e) { Stack errors = new Stack(); errors.push(e); throw new ExtendedSystemException("Error in resuming the given XAResource", errors); } } } // ------ FIX END HERE } Tell me if i'm going wrong Best regards, PHaroZ |