80,82c80,97 < // check for concurrent activity < if (RecoveryManager.readAndUpdateTxMap(tid) == false) { < throw new XAException(XAException.XAER_PROTO); --- > if (onePhase) { > // Synchronizers invoked by coord.beforeCompletion must be > // executed with the transaction context of the transaction > // that is being committed as specified in > // in method javax.Synchronization.beforeCompletion > try { > CurrentTransaction.recreate(tid, 0); > } catch (Throwable e) { > // failed check for concurrent activity > XAException xaExc = new XAException(XAException.XAER_PROTO); > xaExc.initCause(e); > throw xaExc; > } > } else { > // check for concurrrent activity > if (RecoveryManager.readAndUpdateTxMap(tid) == false) { > throw new XAException(XAException.XAER_PROTO); > } 131,134c146,156 < Thread thread = RecoveryManager.removeFromTxMap(tid); < if (thread == null || (thread != Thread.currentThread())) { // error < if (!exceptionFlag) { < throw new XAException(XAException.XAER_RMERR); --- > if (onePhase) { > // Complete full transactional context created for > // beforeCompletion calls in prepare phase of one phase commit. > try { > CurrentTransaction.release(tid); > } catch (Throwable t) { > if (!exceptionFlag) { > XAException xaExc = new XAException(XAException.XAER_PROTO); > xaExc.initCause(t); > throw xaExc; > } 136,137c158,166 < } < } --- > } else { > Thread thread = RecoveryManager.removeFromTxMap(tid); > if (thread == null || (thread != Thread.currentThread())) { // error > if (!exceptionFlag) { > throw new XAException(XAException.XAER_RMERR); > } > } > } > } 175,179d203 < < // check for concurrent activity < if (RecoveryManager.readAndUpdateTxMap(tid) == false) { < throw new XAException(XAException.XAER_PROTO); < } 180a205,217 > try { > // Synchronizers invoked by coord.beforeCompletion must be > // executed with the transaction context of the transaction > // that is being committed as specified in > // in method javax.Synchronization.beforeCompletion > CurrentTransaction.recreate(tid, 0); > } catch (Throwable e) { > // failed check for concurrent activity for transaction tid. > XAException xaExc = new XAException(XAException.XAER_PROTO); > xaExc.initCause(e); > throw xaExc; > } > 216,217c253,255 < Thread thread = RecoveryManager.removeFromTxMap(tid); < if (thread == null || (thread != Thread.currentThread())) { // error --- > try { > CurrentTransaction.release(tid); > } catch (Throwable t) { 219c257,260 < throw new XAException(XAException.XAER_RMERR); --- > errorCode = XAException.XAER_PROTO; > XAException xaExc = new XAException(errorCode); > xaExc.initCause(t); > throw xaExc; 221,222c262,264 < } < } --- > // else allow original exception to be thrown > } > }