public int doPrepare () { try { SubordinateAtomicAction subAct = (SubordinateAtomicAction) super._theTransaction; if (!endSuspendedRMs()) _theTransaction.preventCommit(); int res = subAct.doPrepare(); switch (res) { case TwoPhaseOutcome.PREPARE_READONLY: case TwoPhaseOutcome.PREPARE_NOTOK: TransactionImple.removeTransaction(this); break; } return res; } catch (ClassCastException ex) { ex.printStackTrace(); return TwoPhaseOutcome.INVALID_TRANSACTION; } }
public TransactionImple (AtomicAction act) { super(act); TransactionImple.putTransaction(this); }
/** * Overloads Object.equals() */ public boolean equals(Object obj) { if (jtaLogger.logger.isTraceEnabled()) { jtaLogger.logger.trace("TransactionImple.equals"); } if (obj == null) return false; if (obj == this) return true; if (obj instanceof TransactionImple) { return super.equals(obj); } return false; }
@Test public void testTransactionImple () throws Exception TransactionImple tx = new TransactionImple(0); TransactionImple dummy = new TransactionImple(0); assertFalse(tx.equals(dummy)); tx.commit(); tx.rollback(); assertEquals(tx.doPrepare(), TwoPhaseOutcome.PREPARE_READONLY); tx.doCommit(); dummy.doRollback(); tx = new TransactionImple(10); tx.doOnePhaseCommit(); tx.doForget(); tx.doBeforeCompletion(); assertTrue(tx.toString() != null); assertTrue(tx.activated());
public void doForget () throws IllegalStateException { try { SubordinateAtomicAction subAct = (SubordinateAtomicAction) super._theTransaction; subAct.doForget(); } catch (ClassCastException ex) { throw new IllegalStateException(ex); } finally { TransactionImple.removeTransaction(this); } }
public TransactionImple createSubordinate () throws javax.transaction.NotSupportedException, javax.transaction.SystemException { if (jtaLogger.logger.isTraceEnabled()) { jtaLogger.logger.trace("BaseTransaction.createSubordinate"); } try { checkTransactionState(); } catch (IllegalStateException e1) { NotSupportedException notSupportedException = new NotSupportedException(); notSupportedException.initCause(e1); throw notSupportedException; } catch (Exception e2) { javax.transaction.SystemException systemException = new javax.transaction.SystemException(e2.toString()); systemException.initCause(e2); throw systemException; } Integer value = _timeouts.get(); int v = 0; // if not set then assume 0. What else can we do? if (value != null) { v = value.intValue(); } // TODO set default timeout return new com.arjuna.ats.internal.jta.transaction.arjunacore.subordinate.TransactionImple(v); }
@Override protected Xid createXid(boolean branch, XAModifier theModifier, XAResource xaResource) throws IOException, ObjectStoreException { Xid xid = baseXid(); // We can have subordinate XIDs that can be editted if (xid.getFormatId() != XATxConverter.FORMAT_ID) return xid; Integer eisName = null; if(branch) { if(_xaResourceRecordWrappingPlugin != null) { eisName = _xaResourceRecordWrappingPlugin.getEISName(xaResource); } } xid = new XidImple(xid, branch, eisName); if (theModifier != null) { try { xid = theModifier.createXid((XidImple) xid); } catch (Exception e) { e.printStackTrace(); } } return xid; }
throw new XAException(XAException.XAER_INVAL); if (tx.activated()) tx.doOnePhaseCommit(); else tx.doCommit();
throw new XAException(XAException.XAER_INVAL); if (tx.activated()) tx.doRollback();
/** * * @throws IllegalStateException * * @deprecated Only called from a test */ public void doForget () throws IllegalStateException { try { SubordinateAtomicAction subAct = (SubordinateAtomicAction) super._theTransaction; subAct.doForget(); } catch (ClassCastException ex) { throw new IllegalStateException(ex); } finally { TransactionImple.removeTransaction(this); } }
public TransactionImple createSubordinate () throws javax.transaction.NotSupportedException, javax.transaction.SystemException { if (jtaLogger.logger.isTraceEnabled()) { jtaLogger.logger.trace("BaseTransaction.createSubordinate"); } try { checkTransactionState(); } catch (IllegalStateException e1) { NotSupportedException notSupportedException = new NotSupportedException(); notSupportedException.initCause(e1); throw notSupportedException; } catch (Exception e2) { javax.transaction.SystemException systemException = new javax.transaction.SystemException(e2.toString()); systemException.initCause(e2); throw systemException; } Integer value = _timeouts.get(); int v = 0; // if not set then assume 0. What else can we do? if (value != null) { v = value.intValue(); } // TODO set default timeout return new com.arjuna.ats.internal.jta.transaction.arjunacore.subordinate.TransactionImple(v); }
@Override protected Xid createXid(boolean branch, XAModifier theModifier, XAResource xaResource) throws IOException, ObjectStoreException { Xid xid = baseXid(); // We can have subordinate XIDs that can be editted if (xid.getFormatId() != XATxConverter.FORMAT_ID) return xid; Integer eisName = null; if(branch) { if(_xaResourceRecordWrappingPlugin != null) { eisName = _xaResourceRecordWrappingPlugin.getEISName(xaResource); } } xid = new XidImple(xid, branch, eisName); if (theModifier != null) { try { xid = theModifier.createXid((XidImple) xid); } catch (Exception e) { e.printStackTrace(); } } return xid; }
public int doPrepare () { try { SubordinateAtomicAction subAct = (SubordinateAtomicAction) super._theTransaction; if (!endSuspendedRMs()) _theTransaction.preventCommit(); int res = subAct.doPrepare(); switch (res) { case TwoPhaseOutcome.PREPARE_READONLY: case TwoPhaseOutcome.PREPARE_NOTOK: TransactionImple.removeTransaction(this); break; } return res; } catch (ClassCastException ex) { ex.printStackTrace(); return TwoPhaseOutcome.INVALID_TRANSACTION; } }
/** * * @throws IllegalStateException * * @deprecated Only called from a test */ public void doForget () throws IllegalStateException { try { SubordinateAtomicAction subAct = (SubordinateAtomicAction) super._theTransaction; subAct.doForget(); } catch (ClassCastException ex) { throw new IllegalStateException(ex); } finally { TransactionImple.removeTransaction(this); } }
public TransactionImple createSubordinate () throws javax.transaction.NotSupportedException, javax.transaction.SystemException { if (jtaLogger.logger.isTraceEnabled()) { jtaLogger.logger.trace("BaseTransaction.createSubordinate"); } try { checkTransactionState(); } catch (IllegalStateException e1) { NotSupportedException notSupportedException = new NotSupportedException(); notSupportedException.initCause(e1); throw notSupportedException; } catch (Exception e2) { javax.transaction.SystemException systemException = new javax.transaction.SystemException(e2.toString()); systemException.initCause(e2); throw systemException; } Integer value = _timeouts.get(); int v = 0; // if not set then assume 0. What else can we do? if (value != null) { v = value.intValue(); } // TODO set default timeout return new com.arjuna.ats.internal.jta.transaction.arjunacore.subordinate.TransactionImple(v); }
public TransactionImple (AtomicAction act) { super(act); TransactionImple.putTransaction(this); }
@Override protected Xid createXid(boolean branch, XAModifier theModifier, XAResource xaResource) throws IOException, ObjectStoreException { Xid xid = baseXid(); // We can have subordinate XIDs that can be editted if (xid.getFormatId() != XATxConverter.FORMAT_ID) return xid; Integer eisName = null; if(branch) { if(_xaResourceRecordWrappingPlugin != null) { eisName = _xaResourceRecordWrappingPlugin.getEISName(xaResource); } } xid = new XidImple(xid, branch, eisName); if (theModifier != null) { try { xid = theModifier.createXid((XidImple) xid); } catch (Exception e) { jtaLogger.i18NLogger.warn_cant_create_xid_of_xid(xid, branch, eisName, e); } } return xid; }
/** * Overloads Object.equals() */ public boolean equals(Object obj) { if (jtaLogger.logger.isTraceEnabled()) { jtaLogger.logger.trace("TransactionImple.equals"); } if (obj == null) return false; if (obj == this) return true; if (obj instanceof TransactionImple) { return super.equals(obj); } return false; }
public int doPrepare () { try { SubordinateAtomicAction subAct = (SubordinateAtomicAction) super._theTransaction; if (!endSuspendedRMs()) _theTransaction.preventCommit(); int res = subAct.doPrepare(); switch (res) { case TwoPhaseOutcome.PREPARE_READONLY: case TwoPhaseOutcome.PREPARE_NOTOK: TransactionImple.removeTransaction(this); break; } return res; } catch (ClassCastException ex) { jtaLogger.i18NLogger.error_transaction_class_cast_fail(super._theTransaction, ex); return TwoPhaseOutcome.INVALID_TRANSACTION; } }
/** * * @throws IllegalStateException * * @deprecated Only called from a test */ public void doForget () throws IllegalStateException { try { SubordinateAtomicAction subAct = (SubordinateAtomicAction) super._theTransaction; subAct.doForget(); } catch (ClassCastException ex) { throw new IllegalStateException(ex); } finally { TransactionImple.removeTransaction(this); } }