/** * Add a new resource to a recovered transaction. This is * primarily to allow a new resource that has been provided * through a replay_completion to be added to the transaction and * thereby replacing the original resource that was passed in on * register_resource. */ public void addResourceRecord (Uid rcUid, Resource r) { if (jtsLogger.logger.isDebugEnabled()) { jtsLogger.logger.debug("CachedRecoveredTransaction.addResourceRecord [" + _theTransactionUid + ", " + _theTransactionType + "]" + "(" + rcUid + ")"); } TransactionCache.addResourceRecord(_theTransactionUid, _theTransactionType, rcUid, r); }
/** * Get the status of a transaction that is already in the cache */ public static Status getCachedStatus (Uid actionUid) throws SystemException { TransactionCacheItem cacheItem = getKnown (actionUid); if (cacheItem != null) { return cacheItem.getStatus(); } return Status.StatusNoTransaction; // used to mean it isn't cached }
/** * what is the status of the transaction in the original process ? (if alive) */ Status /* sync ? */ getOriginalStatus () { return TransactionCache.getOriginalStatus(_theTransactionUid,_theTransactionType); }
public static int getRecoveryStatus (Uid actionUid, String theType) { int theRecoveryStatus = RecoveryStatus.NEW; TransactionCacheItem cacheItem = get (actionUid, theType); if (cacheItem != null) { synchronized (cacheItem) { RecoveringTransaction theTransaction = cacheItem.transaction(); if (theTransaction != null) { theRecoveryStatus = theTransaction.getRecoveryStatus(); } } } return theRecoveryStatus; }
/** * Replays phase 2 of the transaction. */ public void replayPhase2() { if (jtsLogger.logger.isDebugEnabled()) { jtsLogger.logger.debug("CachedRecoveredTransaction.replayPhase2 [" + _theTransactionUid + ", " + _theTransactionType + "]"); } TransactionCache.replayPhase2(_theTransactionUid, _theTransactionType); }
/** * Get the recovery status of the transaction */ public int getRecoveryStatus () { return TransactionCache.getRecoveryStatus(_theTransactionUid, _theTransactionType); }
/** * Get the status of the transaction */ public synchronized Status get_status () throws SystemException { Status theStatus = TransactionCache.get_status(_theTransactionUid, _theTransactionType); if (jtsLogger.logger.isDebugEnabled()) { jtsLogger.logger.debug("CachedRecoveredTransaction.get_status [" + _theTransactionUid + ", " + _theTransactionType + "] = " + Utility.stringStatus(theStatus)); } return theStatus; }
public static int getRecoveryStatus (Uid actionUid, String theType) { int theRecoveryStatus = RecoveryStatus.NEW; TransactionCacheItem cacheItem = get (actionUid, theType); if (cacheItem != null) { synchronized (cacheItem) { RecoveringTransaction theTransaction = cacheItem.transaction(); if (theTransaction != null) { theRecoveryStatus = theTransaction.getRecoveryStatus(); } } } return theRecoveryStatus; }
/** * Replays phase 2 of the transaction. */ public void replayPhase2() { if (jtsLogger.logger.isDebugEnabled()) { jtsLogger.logger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_CRASH_RECOVERY, "CachedRecoveredTransaction.replayPhase2 [" +_theTransactionUid+", "+_theTransactionType+"]"); } TransactionCache.replayPhase2(_theTransactionUid, _theTransactionType); }
/** * Get the recovery status of the transaction */ public int getRecoveryStatus () { return TransactionCache.getRecoveryStatus(_theTransactionUid, _theTransactionType); }
/** * Get the status of the transaction */ public synchronized Status get_status () throws SystemException { Status theStatus = TransactionCache.get_status(_theTransactionUid, _theTransactionType); if (jtsLogger.logger.isDebugEnabled()) { jtsLogger.logger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_CRASH_RECOVERY, "CachedRecoveredTransaction.get_status [" +_theTransactionUid+", "+_theTransactionType+"] = " +Utility.stringStatus(theStatus)); } return theStatus; }
/** * Get the status of a transaction as it is in the original process * (so type is not needed) * NoTransaction means the original process has gone */ public static Status getOriginalStatus (Uid actionUid, String theType) throws SystemException { Status theStatus = Status.StatusUnknown; TransactionCacheItem cacheItem = get (actionUid, theType); if (cacheItem != null) { synchronized (cacheItem) { RecoveringTransaction theTransaction = cacheItem.freshTransaction(); if (theTransaction != null) { if (jtsLogger.logger.isDebugEnabled()) { jtsLogger.logger.debug("asking the tran for original status"); } theStatus = theTransaction.getOriginalStatus(); } else { if (jtsLogger.logger.isDebugEnabled()) { jtsLogger.logger.debug("no transaction in cache so not asking for original status"); } } } } return theStatus; }
@Override public boolean doCommit() throws IllegalStateException, HeuristicMixedException, HeuristicRollbackException, HeuristicCommitException, SystemException { if (getStatus() == Status.STATUS_COMMITTING || getStatus() == Status.STATUS_COMMITTED) { TransactionCache.ReplayPhaseReturnStatus replayStatus = TransactionCache.replayPhase2(get_uid(), ServerTransaction.getType()); // either the replay does not fully committed or moved under assumed completed state // returning that we haven't finished yet return replayStatus == TransactionCache.ReplayPhaseReturnStatus.ASSUME_COMPLETED; } else { return super.doCommit(); } } }
/** * what is the status of the transaction in the original process ? (if alive) */ Status /* sync ? */ getOriginalStatus () { return TransactionCache.getOriginalStatus(_theTransactionUid,_theTransactionType); }
/** * Get the status of a transaction that is already in the cache */ public static Status getCachedStatus (Uid actionUid) throws SystemException { TransactionCacheItem cacheItem = getKnown (actionUid); if (cacheItem != null) { return cacheItem.getStatus(); } return Status.StatusNoTransaction; // used to mean it isn't cached }
/** * Add a new resource to a recovered transaction. This is * primarily to allow a new resource that has been provided * through a replay_completion to be added to the transaction and * thereby replacing the original resource that was passed in on * register_resource. */ public void addResourceRecord (Uid rcUid, Resource r) { if (jtsLogger.logger.isDebugEnabled()) { jtsLogger.logger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_CRASH_RECOVERY, "CachedRecoveredTransaction.addResourceRecord [" +_theTransactionUid+", "+_theTransactionType+"]" +"("+rcUid+")"); } TransactionCache.addResourceRecord(_theTransactionUid, _theTransactionType, rcUid, r); }
/** * Get the status of a transaction */ public static Status get_status (Uid actionUid, String theType) throws SystemException { Status theStatus = Status.StatusUnknown; TransactionCacheItem cacheItem = get(actionUid, theType); if (cacheItem != null) { synchronized (cacheItem) { RecoveringTransaction theTransaction = cacheItem.freshTransaction(); if (theTransaction != null) { theStatus = theTransaction.get_status(); // remember the status in the cacheitem cacheItem.setStatus(theStatus); } } } return theStatus; }
/** * Get the status of a transaction */ public static Status get_status (Uid actionUid, String theType) throws SystemException { Status theStatus = Status.StatusUnknown; TransactionCacheItem cacheItem = get(actionUid, theType); if (cacheItem != null) { synchronized (cacheItem) { RecoveringTransaction theTransaction = cacheItem.freshTransaction(); if (theTransaction != null) { theStatus = theTransaction.get_status(); // remember the status in the cacheitem cacheItem.setStatus(theStatus); } } } return theStatus; }