/** * Make sure the transaction is freshly activated and hasn't been replayed * assumed to be called from code synchronized on the TransactionCacheItem */ RecoveringTransaction freshTransaction() { if (_transaction == null || _transaction.getRecoveryStatus() == RecoveryStatus.REPLAYED) { /* * Not sure why we do a reload at all here. But if we do it * based on whether the transaction has really completed, things * stop working. Needs further investigation since there may * be a possible memory leak here. * * TO DO */ // if (!_transaction.allCompleted()) { // The transaction has been replayed, but they want a fresh one // Destroy this transaction and create a new // one thereby reactivating it. // Reactivate as the appropriate transaction class loadTransaction(false); } } return _transaction; }
/** * the transaction type has been changed */ void updateType() { _type = _transaction.type(); }
if (theTransaction.getRecoveryStatus() != RecoveryStatus.ACTIVATE_FAILED) converting = theTransaction.assumeComplete(); if (converting && (jtsLogger.logger.isDebugEnabled())) { jtsLogger.logger.debug(" Transaction "+actionUid+" assumed complete - changing type."); theTransaction.replayPhase2(); cacheItem.setStatus(theTransaction.get_status()); fullyCompleted = theTransaction.allCompleted(); // only remove if committed? theTransaction.removeOldStoreEntry(); cacheItem.updateType(); returnStatus = ReplayPhaseReturnStatus.ASSUME_COMPLETED;
/** * 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 static void addResourceRecord (Uid actionUid, String theType, Uid rcUid, Resource r) { TransactionCacheItem cacheItem = get (actionUid, theType); if (cacheItem != null) { synchronized (cacheItem) { RecoveringTransaction theTransaction = cacheItem.freshTransaction(); if (theTransaction != null) { // As long as the transaction activated okay then try and add // the record. if (theTransaction.getRecoveryStatus() != RecoveryStatus.ACTIVATE_FAILED) { theTransaction.addResourceRecord(rcUid, r); } // with a new resource record, start counting attempts from zero cacheItem.resetAttemptCount(); } } } }
if ( firstLoad && _transaction.getRecoveryStatus() == RecoveryStatus.ACTIVATE_FAILED) { if ( assumed.getRecoveryStatus() != RecoveryStatus.ACTIVATE_FAILED ) { if (jtsLogger.logger.isDebugEnabled()) { jtsLogger.logger.debug("Transaction "+_uid+" previously assumed complete"); _type = _transaction.type(); if ( firstLoad && _transaction.getRecoveryStatus() == RecoveryStatus.ACTIVATE_FAILED) { if ( assumed.getRecoveryStatus() != RecoveryStatus.ACTIVATE_FAILED ) { if (jtsLogger.logger.isDebugEnabled()) { jtsLogger.logger.debug("Transaction "+_uid+" previously assumed complete"); _type = _transaction.type();
/** * 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 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; }
Date timeLastActive = aTransaction.getLastActiveTime(); if (timeLastActive != null && timeLastActive.before(oldestSurviving))
if (theTransaction.getRecoveryStatus() != RecoveryStatus.ACTIVATE_FAILED) converting = theTransaction.assumeComplete(); if (converting && (jtsLogger.loggerI18N.isDebugEnabled())) theTransaction.replayPhase2(); cacheItem.setStatus(theTransaction.get_status()); fullyCompleted = theTransaction.allCompleted(); // only remove if committed? theTransaction.removeOldStoreEntry(); cacheItem.updateType();
/** * 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 static void addResourceRecord (Uid actionUid, String theType, Uid rcUid, Resource r) { TransactionCacheItem cacheItem = get (actionUid, theType); if (cacheItem != null) { synchronized (cacheItem) { RecoveringTransaction theTransaction = cacheItem.freshTransaction(); if (theTransaction != null) { // As long as the transaction activated okay then try and add // the record. if (theTransaction.getRecoveryStatus() != RecoveryStatus.ACTIVATE_FAILED) { theTransaction.addResourceRecord(rcUid, r); } // with a new resource record, start counting attempts from zero cacheItem.resetAttemptCount(); } } } }
if ( firstLoad && _transaction.getRecoveryStatus() == RecoveryStatus.ACTIVATE_FAILED) { if ( assumed.getRecoveryStatus() != RecoveryStatus.ACTIVATE_FAILED ) { if (jtsLogger.loggerI18N.isDebugEnabled()) _type = _transaction.type(); if ( firstLoad && _transaction.getRecoveryStatus() == RecoveryStatus.ACTIVATE_FAILED) { if ( assumed.getRecoveryStatus() != RecoveryStatus.ACTIVATE_FAILED ) { if (jtsLogger.loggerI18N.isDebugEnabled()) _type = _transaction.type();
/** * 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; }
"com.arjuna.ats.internal.jts.recovery.transactions.TransactionCache_1"); theStatus = theTransaction.getOriginalStatus(); } else { if (jtsLogger.loggerI18N.isDebugEnabled())
Date timeLastActive = aTransaction.getLastActiveTime(); if (timeLastActive != null && timeLastActive.before(oldestSurviving))
/** * Make sure the transaction is freshly activated and hasn't been replayed * assumed to be called from code synchronized on the TransactionCacheItem */ RecoveringTransaction freshTransaction() { if (_transaction == null || _transaction.getRecoveryStatus() == RecoveryStatus.REPLAYED) { /* * Not sure why we do a reload at all here. But if we do it * based on whether the transaction has really completed, things * stop working. Needs further investigation since there may * be a possible memory leak here. * * TO DO */ // if (!_transaction.allCompleted()) { // The transaction has been replayed, but they want a fresh one // Destroy this transaction and create a new // one thereby reactivating it. // Reactivate as the appropriate transaction class loadTransaction(false); } } return _transaction; }
/** * the transaction type has been changed */ void updateType() { _type = _transaction.type(); }
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; }
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; }