use of com.arjuna.ats.arjuna.recovery.ExpiryScanner in project narayana by jbosstm.
the class ExpiredEntryMonitor method run.
/**
* performs periodic scans until a shutdwn is notified
*/
public void run() {
while (true) {
tsLogger.logger.debugf("ExpiredEntryMonitor running at %s", _theTimestamper.format(new Date()).toString());
if (_skipNext) {
// make sure we skip at most one scan
_skipNext = false;
tsLogger.i18NLogger.info_recovery_ExpiredEntryMonitor_5();
} else {
Enumeration scanners = _expiryScanners.elements();
while (scanners.hasMoreElements()) {
ExpiryScanner m = (ExpiryScanner) scanners.nextElement();
// check for a shutdown request before starting a scan
synchronized (this) {
if (_stop) {
break;
}
}
// ok go ahead and scan
m.scan();
if (tsLogger.logger.isDebugEnabled()) {
tsLogger.logger.debug(" ");
// bit of space if detailing
}
}
}
try {
// check for shutdown request before we sleep
synchronized (this) {
if (_stop) {
break;
}
wait(_scanIntervalSeconds * 1000);
// check if we were woken because of a shutdown
if (_stop) {
break;
}
}
} catch (InterruptedException e1) {
// we should only get shut down by a shutdown request so ignore interrupts
}
}
}
use of com.arjuna.ats.arjuna.recovery.ExpiryScanner in project narayana by jbosstm.
the class ExpiryScannerStartupUnitTest method testExpiryBackground.
@Test
public void testExpiryBackground() throws Exception {
recoveryPropertyManager.getRecoveryEnvironmentBean().setRecoveryModuleClassNames(Arrays.asList(new String[] { XARecoveryModule.class.getName() }));
recoveryPropertyManager.getRecoveryEnvironmentBean().setExpiryScanners(Arrays.asList(new ExpiryScanner[] { new ExpiryScanner() {
@Override
public void scan() {
AbstractRecord.create(172);
}
@Override
public boolean toBeUsed() {
return true;
}
} }));
recoveryPropertyManager.getRecoveryEnvironmentBean().setPeriodicRecoveryPeriod(1);
recoveryPropertyManager.getRecoveryEnvironmentBean().setRecoveryBackoffPeriod(1);
RecoveryManager rm = RecoveryManager.manager();
rm.terminate(false);
}
Aggregations