public int doOnePhaseCommit () { int result = super.End(true); super.afterCompletion(result); return result; }
public int doPrepare () { if (super.beforeCompletion()) { return super.prepare(true); } super.phase2Abort(true); return TwoPhaseOutcome.PREPARE_NOTOK; }
/** * @deprecated Only called via tests */ public void doForget () { super.forgetHeuristics(); }
public int doCommit () { super.phase2Commit(true); int toReturn; switch (super.getHeuristicDecision()) { case TwoPhaseOutcome.PREPARE_OK: case TwoPhaseOutcome.FINISH_OK: toReturn = super.status(); break; case TwoPhaseOutcome.HEURISTIC_ROLLBACK: toReturn = ActionStatus.H_ROLLBACK; break; case TwoPhaseOutcome.HEURISTIC_COMMIT: toReturn = ActionStatus.H_COMMIT; break; case TwoPhaseOutcome.HEURISTIC_MIXED: toReturn = ActionStatus.H_MIXED; break; case TwoPhaseOutcome.HEURISTIC_HAZARD: default: toReturn = ActionStatus.H_HAZARD; break; } super.afterCompletion(toReturn); return toReturn; }
public int doRollback () { super.phase2Abort(true); int toReturn; switch (super.getHeuristicDecision()) { case TwoPhaseOutcome.PREPARE_OK: case TwoPhaseOutcome.FINISH_OK: toReturn = super.status(); break; case TwoPhaseOutcome.HEURISTIC_ROLLBACK: toReturn = ActionStatus.H_ROLLBACK; break; case TwoPhaseOutcome.HEURISTIC_COMMIT: toReturn = ActionStatus.H_COMMIT; break; case TwoPhaseOutcome.HEURISTIC_MIXED: toReturn = ActionStatus.H_MIXED; break; case TwoPhaseOutcome.HEURISTIC_HAZARD: default: toReturn = ActionStatus.H_HAZARD; break; } super.afterCompletion(toReturn); return toReturn; }
public int doPrepare () { int status = super.status(); // JBTM-927 it is possible this transaction has been aborted by the TransactionReaper if (status == ActionStatus.ABORTED) { return TwoPhaseOutcome.PREPARE_NOTOK; } // In JTA spec, beforeCompletions are run on commit attempts only, not rollbacks. // We attempt to mimic that here, even though we are outside the scope of the spec. // note it's not perfect- async timeout/rollback means there is a race condition in which we // can still call beforeCompletion on rollbacks, but that's not too bad as skipping it is really // just an optimization anyhow. JBTM-429 if ( !(status == ActionStatus.ABORT_ONLY || status == ActionStatus.ABORTING) && doBeforeCompletion()) { int outcome = super.prepare(true); if(outcome == TwoPhaseOutcome.PREPARE_READONLY) { // we won't get called again, so we need to clean up // and run the afterCompletions before returning. doCommit(); } return outcome; } else { super.phase2Abort(true); super.afterCompletion(Status.STATUS_ROLLEDBACK); return TwoPhaseOutcome.PREPARE_NOTOK; } }
public int doOnePhaseCommit () { int status = super.status(); // In JTA spec, beforeCompletions are run on commit attempts only, not rollbacks. // We attempt to mimic that here, even though we are outside the scope of the spec. // note it's not perfect- async timeout/rollback means there is a race condition in which we // can still call beforeCompletion on rollbacks, but that's not too bad as skipping it is really // just an optimization anyhow. JBTM-429 if (status == ActionStatus.ABORT_ONLY || doBeforeCompletion()) { status = super.End(true); } else { status = ActionStatus.ABORTED; } afterCompletion(status); return status; }
String transactionType = new AtomicAction().type();
public int doPrepare () { int status = super.status(); // In JTA spec, beforeCompletions are run on commit attempts only, not rollbacks. // We attempt to mimic that here, even though we are outside the scope of the spec. // note it's not perfect- async timeout/rollback means there is a race condition in which we // can still call beforeCompletion on rollbacks, but that's not too bad as skipping it is really // just an optimization anyhow. JBTM-429 if ( !(status == ActionStatus.ABORT_ONLY || status == ActionStatus.ABORTING) && doBeforeCompletion()) { int outcome = super.prepare(true); if(outcome == TwoPhaseOutcome.PREPARE_READONLY) { // we won't get called again, so we need to clean up // and run the afterCompletions before returning. doCommit(); } return outcome; } else { super.phase2Abort(true); return TwoPhaseOutcome.PREPARE_NOTOK; } }
public boolean doBeforeCompletion () { // should not need synchronizing at this level if (!_doneBefore) { _beforeOutcome = super.beforeCompletion(); _doneBefore = true; } return _beforeOutcome; }
/** * Create a new transaction with the specified timeout. */ public TransactionImple(int timeout) { _theTransaction = new AtomicAction(); _theTransaction.begin(timeout); _resources = new Hashtable(); _duplicateResources = new Hashtable(); _suspendCount = 0; _xaTransactionTimeoutEnabled = getXATransactionTimeoutEnabled(); _txLocalResources = Collections.synchronizedMap(new HashMap()); }
AtomicAction aa = new AtomicAction(); aa.begin(); assertEquals(AddOutcome.AR_ADDED, aa.add(new XAResourceRecord(null, new XARRTestResource(), new XidImple(aa), null))); RecoverAtomicAction rcvAtomicAction = new RecoverAtomicAction(aa.get_uid(), ActionStatus.COMMITTED); rcvAtomicAction.replayPhase2(); aa.abort();
public int doCommit () { super.phase2Commit(true); int toReturn; switch (super.getHeuristicDecision()) { case TwoPhaseOutcome.PREPARE_OK: case TwoPhaseOutcome.FINISH_OK: toReturn = super.status(); break; case TwoPhaseOutcome.HEURISTIC_ROLLBACK: toReturn = ActionStatus.H_ROLLBACK; break; case TwoPhaseOutcome.HEURISTIC_COMMIT: toReturn = ActionStatus.H_COMMIT; break; case TwoPhaseOutcome.HEURISTIC_MIXED: toReturn = ActionStatus.H_MIXED; break; case TwoPhaseOutcome.HEURISTIC_HAZARD: default: toReturn = ActionStatus.H_HAZARD; break; } super.afterCompletion(toReturn); return toReturn; }
public int doRollback () super.phase2Abort(true); switch (super.getHeuristicDecision()) toReturn = super.status(); break; case TwoPhaseOutcome.HEURISTIC_ROLLBACK: super.afterCompletion(toReturn);
public int doPrepare () { int status = super.status(); // JBTM-927 it is possible this transaction has been aborted by the TransactionReaper if (status == ActionStatus.ABORTED) { return TwoPhaseOutcome.PREPARE_NOTOK; } // In JTA spec, beforeCompletions are run on commit attempts only, not rollbacks. // We attempt to mimic that here, even though we are outside the scope of the spec. // note it's not perfect- async timeout/rollback means there is a race condition in which we // can still call beforeCompletion on rollbacks, but that's not too bad as skipping it is really // just an optimization anyhow. JBTM-429 if ( !(status == ActionStatus.ABORT_ONLY || status == ActionStatus.ABORTING) && doBeforeCompletion()) { int outcome = super.prepare(true); if(outcome == TwoPhaseOutcome.PREPARE_READONLY) { // we won't get called again, so we need to clean up // and run the afterCompletions before returning. doCommit(); } return outcome; } else { super.phase2Abort(true); super.afterCompletion(Status.STATUS_ROLLEDBACK); return TwoPhaseOutcome.PREPARE_NOTOK; } }
public int doOnePhaseCommit () { int status = super.status(); // In JTA spec, beforeCompletions are run on commit attempts only, not rollbacks. // We attempt to mimic that here, even though we are outside the scope of the spec. // note it's not perfect- async timeout/rollback means there is a race condition in which we // can still call beforeCompletion on rollbacks, but that's not too bad as skipping it is really // just an optimization anyhow. JBTM-429 if (status == ActionStatus.ABORT_ONLY || doBeforeCompletion()) { status = super.End(true); } else { status = ActionStatus.ABORTED; } afterCompletion(status); TransactionReaper.transactionReaper().remove(this); return status; }
String transactionType = new AtomicAction().type();
public boolean doBeforeCompletion () { // should not need synchronizing at this level if (!_doneBefore) { _beforeOutcome = super.beforeCompletion(); _doneBefore = true; } return _beforeOutcome; }
/** * Create a new transaction with the specified timeout. */ public TransactionImple(int timeout) { _theTransaction = new AtomicAction(); _theTransaction.begin(timeout); _resources = new Hashtable(); _duplicateResources = new Hashtable(); _suspendCount = 0; _xaTransactionTimeoutEnabled = getXATransactionTimeoutEnabled(); _txLocalResources = Collections.synchronizedMap(new HashMap()); }
public int doCommit () { super.phase2Commit(true); int toReturn; switch (super.getHeuristicDecision()) { case TwoPhaseOutcome.PREPARE_OK: case TwoPhaseOutcome.FINISH_OK: toReturn = super.status(); break; case TwoPhaseOutcome.HEURISTIC_ROLLBACK: toReturn = ActionStatus.H_ROLLBACK; break; case TwoPhaseOutcome.HEURISTIC_COMMIT: toReturn = ActionStatus.H_COMMIT; break; case TwoPhaseOutcome.HEURISTIC_MIXED: toReturn = ActionStatus.H_MIXED; break; case TwoPhaseOutcome.HEURISTIC_HAZARD: default: toReturn = ActionStatus.H_HAZARD; break; } super.afterCompletion(toReturn); TransactionReaper.transactionReaper().remove(this); return toReturn; }