public static void purgeActions (Thread t) { purgeActions(t, true); }
/** * @return the thread's notion of the current transaction. */ public static BasicAction Current () { return ThreadActionData.currentAction(); }
public Integer call() throws Exception { /* * This is a transient thread so we don't want to register it * with the action it is preparing, only change its notion of * the current transaction so that any abstract records that * need that information can still have it. */ ThreadActionData.pushAction(_theAction, false); _outcome = _theAction.doPrepare(_reportHeuristics, _theRecord); ThreadActionData.popAction(false); return _outcome; }
/** * Start the transaction running. * * If the transaction is already running or has terminated, then an error * code will be returned. * * @param timeout the timeout associated with the transaction. If the * transaction is still active when this timeout elapses, the * system will automatically roll it back. * * @return <code>ActionStatus</code> indicating outcome. */ public int begin (int timeout) { int status = super.start(); if (status == ActionStatus.RUNNING) { /* * Now do thread/action tracking. */ ThreadActionData.pushAction(this); _timeout = timeout; if (_timeout == 0) _timeout = TxControl.getDefaultTimeout(); if (_timeout > 0) TransactionReaper.transactionReaper().insert(this, _timeout); } return status; }
/** * Abort (rollback) the transaction. * * If the transaction has already terminated, or has not been begun, then an * appropriate error code will be returned. * * @return <code>ActionStatus</code> indicating outcome. */ public int abort () { int status = super.cancel(); /* * Now remove this thread from the action state. */ ThreadActionData.popAction(); TransactionReaper.transactionReaper().remove(this); return status; }
throw new INVALID_TRANSACTION(ExceptionCodes.SERVERAA_NO_CONTROL, CompletionStatus.COMPLETED_NO); throw new INVALID_TRANSACTION(ExceptionCodes.NO_TRANSACTION, CompletionStatus.COMPLETED_NO); ThreadActionData.popAction(); ThreadActionData.popAction(); ThreadActionData.popAction(); ThreadActionData.popAction(); ThreadActionData.popAction(); throw new UNKNOWN(e7.toString()); ThreadActionData.popAction();
throw new INVALID_TRANSACTION(ExceptionCodes.SERVERAA_NO_CONTROL, CompletionStatus.COMPLETED_NO); jtsLogger.i18NLogger.warn_orbspecific_interposition_resources_arjuna_notx("ServerTopLevelAction.commit_one_phase"); throw new INVALID_TRANSACTION(ExceptionCodes.NO_TRANSACTION, CompletionStatus.COMPLETED_NO); ThreadActionData.pushAction(theTransaction); // LockManager needs to know if there is a transaction ThreadActionData.popAction(); ThreadActionData.popAction(); ThreadActionData.popAction(); ThreadActionData.popAction(); ThreadActionData.popAction(); throw new UNKNOWN(e7.toString()); ThreadActionData.popAction();
public static BasicAction popAction (boolean unregister) throws EmptyStackException { return popAction(ThreadUtil.getThreadId(), unregister); }
throw new INVALID_TRANSACTION(ExceptionCodes.SERVERAA_NO_CONTROL, CompletionStatus.COMPLETED_NO); ThreadActionData.popAction(); throw new INVALID_TRANSACTION(ExceptionCodes.INVALID_ACTION, CompletionStatus.COMPLETED_NO); case TwoPhaseOutcome.PREPARE_OK: return Vote.VoteCommit; if (TxControl.getMaintainHeuristics()) destroyResource(); throw new HeuristicMixed(); // will eventually get forget case TwoPhaseOutcome.HEURISTIC_HAZARD: default: if (TxControl.getMaintainHeuristics()) destroyResource(); throw new HeuristicHazard();
throw new INVALID_TRANSACTION(ExceptionCodes.SERVERAA_NO_CONTROL, CompletionStatus.COMPLETED_NO); ThreadActionData.pushAction(theTransaction); // LockManager needs to know if there is a transaction ThreadActionData.popAction(); throw new INVALID_TRANSACTION(ExceptionCodes.SERVERAA_NO_CONTROL, CompletionStatus.COMPLETED_NO); case ActionStatus.COMMITTED: case ActionStatus.H_COMMIT: case ActionStatus.ABORTED: case ActionStatus.H_ROLLBACK: if (TxControl.getMaintainHeuristics()) destroyResource(); throw new HeuristicRollback(); case ActionStatus.H_MIXED: if (TxControl.getMaintainHeuristics()) destroyResource(); throw new HeuristicMixed(); case ActionStatus.H_HAZARD: if (TxControl.getMaintainHeuristics()) destroyResource(); throw new HeuristicHazard();
public static void purgeAction (BasicAction act, Thread t) throws NoSuchElementException { ThreadActionData.purgeAction(act, t, true); }
public static BasicAction currentAction () { ThreadActionData.setup(); Deque<BasicAction> txs = _threadList.get(); if (txs != null && !txs.isEmpty()) { return txs.peekFirst(); } return null; }
/** * Resume transaction association on the current thread. If the specified * transaction is null, then this is the same as doing a suspend. If the * current thread is associated with transactions then those associations * will be lost. * * @param act the transaction to associate. If this is a nested * transaction, then the thread will be associated with all of * the transactions in the hierarchy. * * @return <code>true</code> if association is successful, * <code>false</code> otherwise. */ public static final boolean resume (AtomicAction act) { if (act == null) { suspend(); } else ThreadActionData.restoreActions(act); return true; }
@Test public void testCheckDeferredHeuristicRollbackFirstResourceFails() throws Exception { ThreadActionData.purgeActions(); TxControl.setXANodeName("test"); TransactionImple tx = new TransactionImple(500); try { tx.enlistResource(new FailureXAResource(FailLocation.commit, FailType.nota)); tx.enlistResource(new TestResource()); } catch (final RollbackException ex) { fail(); } try { tx.commit(); fail(); } catch (final HeuristicMixedException ex) { assertEquals(XAException.XAER_NOTA, ((XAException) ex.getSuppressed()[0]).errorCode); } }
/** * Start the transaction running. * * If the transaction is already running or has terminated, then an error * code will be returned. * * @param timeout the timeout associated with the transaction. If the * transaction is still active when this timeout elapses, the * system will automatically roll it back. * * @return <code>ActionStatus</code> indicating outcome. */ public int begin (int timeout) { int status = super.start(); if (status == ActionStatus.RUNNING) { /* * Now do thread/action tracking. */ ThreadActionData.pushAction(this); _timeout = timeout; if (_timeout == 0) _timeout = TxControl.getDefaultTimeout(); if (_timeout > 0) TransactionReaper.transactionReaper().insert(this, _timeout); } return status; }
/** * Abort (rollback) the transaction. * * If the transaction has already terminated, or has not been begun, then an * appropriate error code will be returned. * * @return <code>ActionStatus</code> indicating outcome. */ public int abort () { int status = super.cancel(); /* * Now remove this thread from the action state. */ ThreadActionData.popAction(); TransactionReaper.transactionReaper().remove(this); return status; }
"ServerNestedAction.rollback_subtransaction"); throw new INVALID_TRANSACTION(ExceptionCodes.SERVERAA_NO_CONTROL, CompletionStatus.COMPLETED_NO); throw new UNKNOWN(ex.toString()); ThreadActionData.popAction(); destroyResource();
public static BasicAction popAction (boolean unregister) throws NoSuchElementException { return popAction(ThreadUtil.getThreadId(), unregister); }
throw new INVALID_TRANSACTION(ExceptionCodes.SERVERAA_NO_CONTROL, CompletionStatus.COMPLETED_NO); ThreadActionData.popAction(); throw new INVALID_TRANSACTION(ExceptionCodes.SERVERAA_NO_CONTROL, CompletionStatus.COMPLETED_NO); case ActionStatus.COMMITTED: case ActionStatus.H_COMMIT: case ActionStatus.ABORTED: case ActionStatus.H_ROLLBACK: if (TxControl.getMaintainHeuristics()) destroyResource(); throw new HeuristicRollback(); case ActionStatus.H_MIXED: if (TxControl.getMaintainHeuristics()) destroyResource(); throw new HeuristicMixed(); case ActionStatus.H_HAZARD: if (TxControl.getMaintainHeuristics()) destroyResource(); throw new HeuristicHazard();
throw new INVALID_TRANSACTION(ExceptionCodes.SERVERAA_NO_CONTROL, CompletionStatus.COMPLETED_NO); ThreadActionData.pushAction(theTransaction); // LockManager needs to know if there is a transaction ThreadActionData.popAction(); throw new INVALID_TRANSACTION(ExceptionCodes.INVALID_ACTION, CompletionStatus.COMPLETED_NO); case ActionStatus.ABORTED: case ActionStatus.H_ROLLBACK: throw new HeuristicCommit(); case ActionStatus.H_MIXED: if (TxControl.getMaintainHeuristics()) destroyResource(); throw new HeuristicMixed(); case ActionStatus.H_HAZARD: if (TxControl.getMaintainHeuristics()) destroyResource(); throw new HeuristicHazard();