public SubordinateAtomicAction (int timeout) { super(); subordinate = true; start(); _timeout = timeout; // if it has a non-negative timeout, add it to the reaper. if (timeout > AtomicAction.NO_TIMEOUT) TransactionReaper.transactionReaper().insert(this, timeout); }
/** * Starting with 4.8, this method will always return an instance, will never return null. * This causes the reaper to be instantiated unnecessarily in some cases, but that's cheaper * than the alternatives. * * @return a TransactionReaper singleton. */ public static TransactionReaper transactionReaper() { if(_theReaper == null) { instantiate(); } return _theReaper; }
public int end (boolean report_heuristics) { int outcome = super.end(report_heuristics); /* * Now remove this thread from the reaper. Leave * the thread-to-tx association though. */ TransactionReaper.transactionReaper().remove(this); return outcome; }
final long next = nextDynamicCheckTime.get(); reaperElement = _reaperElements.getFirst(); tsLogger.i18NLogger.warn_coordinator_TransactionReaper_18(reaperElement._control.get_uid(), reaperElement.statusName()); reinsertElement(reaperElement, _cancelWaitPeriod); tsLogger.logger.trace("Reaper scheduling TX for cancellation " + reaperElement._control.get_uid()); reinsertElement(reaperElement, _cancelWaitPeriod); tsLogger.logger.trace("Reaper deferring interrupt for TX scheduled for cancel " + reaperElement._control.get_uid()); reinsertElement(reaperElement, _cancelFailWaitPeriod); tsLogger.i18NLogger.error_coordinator_TransactionReaper_5(Integer.toString(_zombieCount)); _reaperWorkerThread.start(); removeElementReaper(reaperElement); tsLogger.i18NLogger.warn_coordinator_TransactionReaper_10(reaperElement._control.get_uid()); notifyListeners(reaperElement._control, false); } else { removeElementReaper(reaperElement);
TransactionReaper._dynamic = false; tsLogger.i18NLogger.warn_coordinator_TransactionReaper_19(); checkPeriod = arjPropertyManager.getCoordinatorEnvironmentBean().getTxReaperTimeout(); TransactionReaper._theReaper = new TransactionReaper(checkPeriod); _reaperWorkerThread = new ReaperWorkerThread(TransactionReaper._theReaper); _reaperWorkerThread.setDaemon(true); _reaperWorkerThread.start();
/** * 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; }
_theReaper.waitForCancellations(); _theReaper.doCancellations();
sleepPeriod = reaperObject.checkingPeriod(); reaperObject.check();
public GlobalTransactionInfo getGlobalInfo () throws SystemException { GlobalTransactionInfo info = new GlobalTransactionInfo(); info.totalNumberOfTransactions = (int)com.arjuna.ats.arjuna.coordinator.TxStats.getInstance().getNumberOfTransactions(); info.numberOfCommittedTransactions = (int)com.arjuna.ats.arjuna.coordinator.TxStats.getInstance().getNumberOfCommittedTransactions(); info.numberOfAbortedTransactions = (int)com.arjuna.ats.arjuna.coordinator.TxStats.getInstance().getNumberOfAbortedTransactions(); if (info.totalNumberOfTransactions > 0) info.averageLifetime = (float) (TransactionReaper.transactionLifetime() / info.totalNumberOfTransactions); else info.averageLifetime = (float) 0.0; info.numberOfHeuristics = (int)com.arjuna.ats.arjuna.coordinator.TxStats.getInstance().getNumberOfHeuristics(); TransactionReaper reaper = TransactionReaper.transactionReaper(); if (reaper.checkingPeriod() == Long.MAX_VALUE) info.reaperTimeout = 0; else info.reaperTimeout = (int) reaper.checkingPeriod(); info.defaultTimeout = TxControl.getDefaultTimeout(); return info; }
public ReaperThread (TransactionReaper arg) { reaperObject = arg; sleepPeriod = reaperObject.checkingPeriod(); _shutdown = false; }
final long next = nextDynamicCheckTime.get(); reaperElement = _reaperElements.getFirst(); tsLogger.i18NLogger.warn_coordinator_TransactionReaper_18(reaperElement._control.get_uid(), reaperElement.statusName()); reinsertElement(reaperElement, _cancelWaitPeriod); tsLogger.logger.trace("Reaper scheduling TX for cancellation " + reaperElement._control.get_uid()); reinsertElement(reaperElement, _cancelWaitPeriod); tsLogger.logger.trace("Reaper deferring interrupt for TX scheduled for cancel " + reaperElement._control.get_uid()); reinsertElement(reaperElement, _cancelFailWaitPeriod); tsLogger.i18NLogger.error_coordinator_TransactionReaper_5(Integer.toString(_zombieCount)); _reaperWorkerThread.start(); removeElementReaper(reaperElement); tsLogger.i18NLogger.warn_coordinator_TransactionReaper_10(reaperElement._control.get_uid()); notifyListeners(reaperElement._control, false); } else { removeElementReaper(reaperElement);
TransactionReaper._dynamic = false; tsLogger.i18NLogger.warn_coordinator_TransactionReaper_19(); checkPeriod = arjPropertyManager.getCoordinatorEnvironmentBean().getTxReaperTimeout(); TransactionReaper._theReaper = new TransactionReaper(checkPeriod); _reaperWorkerThread = new ReaperWorkerThread(TransactionReaper._theReaper); _reaperWorkerThread.setDaemon(true); _reaperWorkerThread.start();
/** * 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; }
_theReaper.waitForCancellations(); _theReaper.doCancellations();
sleepPeriod = reaperObject.checkingPeriod(); reaperObject.check();
public GlobalTransactionInfo getGlobalInfo () throws SystemException { GlobalTransactionInfo info = new GlobalTransactionInfo(); info.totalNumberOfTransactions = (int)com.arjuna.ats.arjuna.coordinator.TxStats.getInstance().getNumberOfTransactions(); info.numberOfCommittedTransactions = (int)com.arjuna.ats.arjuna.coordinator.TxStats.getInstance().getNumberOfCommittedTransactions(); info.numberOfAbortedTransactions = (int)com.arjuna.ats.arjuna.coordinator.TxStats.getInstance().getNumberOfAbortedTransactions(); if (info.totalNumberOfTransactions > 0) info.averageLifetime = (float) (TransactionReaper.transactionLifetime() / info.totalNumberOfTransactions); else info.averageLifetime = (float) 0.0; info.numberOfHeuristics = (int)com.arjuna.ats.arjuna.coordinator.TxStats.getInstance().getNumberOfHeuristics(); TransactionReaper reaper = TransactionReaper.transactionReaper(); if (reaper.checkingPeriod() == Long.MAX_VALUE) info.reaperTimeout = 0; else info.reaperTimeout = (int) reaper.checkingPeriod(); info.defaultTimeout = TxControl.getDefaultTimeout(); return info; }
public ReaperThread (TransactionReaper arg) { super("Transaction Reaper"); reaperObject = arg; sleepPeriod = reaperObject.checkingPeriod(); _shutdown = false; }
final long next = nextDynamicCheckTime.get(); reaperElement = _reaperElements.getFirst(); tsLogger.i18NLogger.warn_coordinator_TransactionReaper_18(reaperElement._control.get_uid(), reaperElement.statusName()); reinsertElement(reaperElement, _cancelWaitPeriod); tsLogger.logger.trace("Reaper scheduling TX for cancellation " + reaperElement._control.get_uid()); reinsertElement(reaperElement, _cancelWaitPeriod); tsLogger.logger.trace("Reaper deferring interrupt for TX scheduled for cancel " + reaperElement._control.get_uid()); reinsertElement(reaperElement, _cancelFailWaitPeriod); tsLogger.i18NLogger.error_coordinator_TransactionReaper_5(Integer.toString(_zombieCount)); _reaperWorkerThread.start(); removeElementReaper(reaperElement); tsLogger.i18NLogger.warn_coordinator_TransactionReaper_10(reaperElement._control.get_uid()); notifyListeners(reaperElement._control, false); } else { removeElementReaper(reaperElement);