public final void scan () { _periodicRecovery.doWork(); }
/** * wait until some other thread stops scanning * * <b>Caveats:</b> this must only be called when synchronized on {@link PeriodicRecovery#_stateLock} and when * _currentStatus is SCANNING */ private void doScanningWait() { while (getStatus() == Status.SCANNING) { try { _stateLock.wait(); } catch (InterruptedException e) { // we can ignore this exception } } }
/** * Start the background thread to perform the periodic recovery */ public void run () { boolean finished = false; do { checkSuspended(); finished = doWork(true); } while (!finished); }
initialise(); loadModules(); _listener = new Listener(getServerSocket(), _workerService); _listener.setDaemon(true); tsLogger.i18NLogger.info_recovery_PeriodicRecovery_13(_socket.getInetAddress().getHostAddress(), Integer.toString(_socket.getLocalPort())); tsLogger.i18NLogger.warn_recovery_PeriodicRecovery_9(ex); tsLogger.logger.debug("PeriodicRecovery: starting background scanner thread"); start(); tsLogger.logger.debug("PeriodicRecovery: starting listener worker thread"); _listener.start();
tsLogger.i18NLogger.fatal_recovery_fail(RecoveryManager.getRecoveryManagerHost().getHostAddress(), Integer.toString(RecoveryManager.getRecoveryManagerPort())); tsLogger.i18NLogger.fatal_recovery_fail("unknown", "unknown"); _periodicRecovery = new PeriodicRecovery(threaded, useListener); tsLogger.i18NLogger.info_recovery_socketready( Integer.toString(_periodicRecovery.getServerSocket().getLocalPort()));
Vector copyOfModules = getModules(); Enumeration modules = copyOfModules.elements(); ClassLoader cl = switchClassLoader(m); try { m.periodicWorkFirstPass(); } finally { restoreClassLoader(cl); doBackoffWait(); if (getMode() == Mode.TERMINATED) { if (tsLogger.logger.isDebugEnabled()) { tsLogger.logger.debug("PeriodicRecovery: scan TERMINATED at phase 1"); modules = copyOfModules.elements(); ClassLoader cl = switchClassLoader(m); try { m.periodicWorkSecondPass(); } finally { restoreClassLoader(cl);
/** * initialise the periodic recovery instance to a suitable initial state */ private void initialise () { _recoveryModules = new Vector(); setStatus(Status.INACTIVE); setMode(Mode.ENABLED); _recoveryPeriod = recoveryPropertyManager.getRecoveryEnvironmentBean().getPeriodicRecoveryPeriod(); if (_recoveryPeriod != _defaultRecoveryPeriod && tsLogger.arjLogger.isDebugEnabled()) { tsLogger.arjLogger.debug ( DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PRIVATE, FacilityCode.FAC_CRASH_RECOVERY, "com.arjuna.ats.arjuna.recovery.PeriodicRecovery" + ": Recovery period set to " + _recoveryPeriod + " seconds" ); } _backoffPeriod = recoveryPropertyManager.getRecoveryEnvironmentBean().getRecoveryBackoffPeriod(); if (_backoffPeriod != _defaultBackoffPeriod && tsLogger.arjLogger.isDebugEnabled()) { tsLogger.arjLogger.debug ( DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PRIVATE, FacilityCode.FAC_CRASH_RECOVERY, "PeriodicRecovery" + ": Backoff period set to " + _backoffPeriod + " seconds" ); } }
if (getStatus() != State.active) tsLogger.arjLoggerI18N.info("com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery_10", new Object[]{new Integer(getStatus())}); setStatus(State.scanning); _theTimestamper.format(new Date()) + ">" ); Enumeration modules = _recoveryModules.elements(); if (getStatus() == State.terminated) checkSuspended(); setStatus(State.scanning); _theTimestamper.format(new Date()) + ">" ); modules = _recoveryModules.elements(); if (getStatus() == State.terminated) checkSuspended(); setStatus(State.active);
_periodicRecovery = new PeriodicRecovery(threaded, useListener); new Object[] { _periodicRecovery.getServerSocket().getLocalPort() });
_listener.stopListener(); if (getMode() != Mode.TERMINATED) { if (tsLogger.logger.isDebugEnabled()) { tsLogger.logger.debug("PeriodicRecovery: Mode <== TERMINATED"); setMode(Mode.TERMINATED); _stateLock.notifyAll(); while (getStatus() == Status.SCANNING) { try { if (tsLogger.logger.isDebugEnabled()) { if (!async && this.isAlive()) { try { this.join(); } catch (InterruptedException e) {
public PeriodicRecovery (boolean threaded) { setDaemon(true); initialise(); // Load the recovery modules that actually do the work. loadModules(); try { _workerService = new WorkerService(this); _listener = new Listener(getServerSocket(), _workerService); _listener.setDaemon(true); } catch (Exception ex) { if (tsLogger.arjLoggerI18N.isWarnEnabled()) { tsLogger.arjLoggerI18N.warn("com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery_9", new Object[]{ex}); } } if (threaded) { start(); } _listener.start(); }
/** * initialise the periodic recovery instance to a suitable initial state */ private void initialise () { setStatus(Status.INACTIVE); setMode(Mode.ENABLED); _recoveryPeriod = recoveryPropertyManager.getRecoveryEnvironmentBean().getPeriodicRecoveryPeriod(); if (_recoveryPeriod != _defaultRecoveryPeriod && tsLogger.logger.isDebugEnabled()) { tsLogger.logger.debug("com.arjuna.ats.arjuna.recovery.PeriodicRecovery" + ": Recovery period set to " + _recoveryPeriod + " seconds"); } _backoffPeriod = recoveryPropertyManager.getRecoveryEnvironmentBean().getRecoveryBackoffPeriod(); if (_backoffPeriod != _defaultBackoffPeriod && tsLogger.logger.isDebugEnabled()) { tsLogger.logger.debug("PeriodicRecovery" + ": Backoff period set to " + _backoffPeriod + " seconds"); } }
public final void addModule (RecoveryModule module) { _periodicRecovery.addModule(module); }
initialise(); loadModules(); _listener = new Listener(getServerSocket(), _workerService); _listener.setDaemon(true); tsLogger.i18NLogger.info_recovery_PeriodicRecovery_13(_socket.getInetAddress().getHostAddress(), Integer.toString(_socket.getLocalPort())); tsLogger.i18NLogger.warn_recovery_PeriodicRecovery_9(ex); tsLogger.logger.debug("PeriodicRecovery: starting background scanner thread"); start(); tsLogger.logger.debug("PeriodicRecovery: starting listener worker thread"); _listener.start();
tsLogger.i18NLogger.fatal_recovery_fail(RecoveryManager.getRecoveryManagerHost().getHostAddress(), Integer.toString(RecoveryManager.getRecoveryManagerPort())); tsLogger.i18NLogger.fatal_recovery_fail("unknown", "unknown"); _periodicRecovery = new PeriodicRecovery(threaded, useListener); tsLogger.i18NLogger.info_recovery_socketready( Integer.toString(_periodicRecovery.getServerSocket().getLocalPort()));
Vector copyOfModules = getModules(); Enumeration modules = copyOfModules.elements(); ClassLoader cl = switchClassLoader(m); try { m.periodicWorkFirstPass(); } finally { restoreClassLoader(cl); doBackoffWait(); if (getMode() == Mode.TERMINATED) { if (tsLogger.logger.isDebugEnabled()) { tsLogger.logger.debug("PeriodicRecovery: scan TERMINATED at phase 1"); modules = copyOfModules.elements(); ClassLoader cl = switchClassLoader(m); try { m.periodicWorkSecondPass(); } finally { restoreClassLoader(cl);