void abortAll() throws IOException { Iterator myTxns = theTxns.keySet().iterator(); while (myTxns.hasNext()) { TxnId myId = (TxnId) myTxns.next(); TxnState myState = getState(myId); try { int myStatus = myState.getStatus(); if ((myStatus == TransactionConstants.PREPARED) || (myStatus == TransactionConstants.ACTIVE)) { /* * AbortAll is a naive operation in that it has no * awareness of a specific transaction thus it cannot * explicitly vote one of them off so we must do it * ourselves */ myState.vote(); myState.abort(); myTxns.remove(); } } catch (TransactionException aTE) { // Whoops, got nailed checking status, logged in the call // nothing to do. } } }
/** Do not call this method directly - it should only be invoked from a Prevayler command. */ void abort(TxnId anId) throws UnknownTransactionException, IOException { TxnState myState = getTxnFor(anId, null, true); myState.abort(); removeTxn(anId); }