use of com.arjuna.ats.arjuna.recovery.RecoveryManager in project narayana by jbosstm.
the class XAResourceRecord method getNewXAResource.
/**
* This routine finds the new XAResource for the transaction that used the
* old resource we couldn't serialize. It does this by looking up the
* XARecoveryModule in the recovery manager and asking it for the
* XAResource. The recovery manager will then look through its list of
* registered XARecoveryResource implementations for the appropriate
* instance. If the XARecoveryModule hasn't been initialised yet then this
* routine will fail, but on the next scan it should work.
*/
private final XAResource getNewXAResource() {
RecoveryManager recMan = RecoveryManager.manager();
Vector recoveryModules = recMan.getModules();
if (recoveryModules != null) {
Enumeration modules = recoveryModules.elements();
while (modules.hasMoreElements()) {
RecoveryModule m = (RecoveryModule) modules.nextElement();
if (m instanceof XARecoveryModule) {
return ((XARecoveryModule) m).getNewXAResource(this);
}
}
}
return null;
}
use of com.arjuna.ats.arjuna.recovery.RecoveryManager 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);
}
use of com.arjuna.ats.arjuna.recovery.RecoveryManager in project wildfly by wildfly.
the class InboundBridgeService method addDeserializerAndOrphanFilter.
private void addDeserializerAndOrphanFilter() {
final RecoveryManager recoveryManager = RecoveryManager.manager();
for (RecoveryModule recoveryModule : recoveryManager.getModules()) {
if (recoveryModule instanceof XARecoveryModule) {
orphanFilter = new InboundBridgeOrphanFilter();
((XARecoveryModule) recoveryModule).addXAResourceOrphanFilter(orphanFilter);
((XARecoveryModule) recoveryModule).addSerializableXAResourceDeserializer(new InboundBridge());
}
}
}
use of com.arjuna.ats.arjuna.recovery.RecoveryManager in project narayana by jbosstm.
the class RecoveryLifecycleTest method test.
@Test
public void test() {
recoveryPropertyManager.getRecoveryEnvironmentBean().setRecoveryBackoffPeriod(1);
RecoveryManager manager = RecoveryManager.manager(RecoveryManager.DIRECT_MANAGEMENT);
DummyRecoveryModule module = new DummyRecoveryModule();
manager.addModule(module);
manager.scan();
assertTrue(module.finished());
manager.terminate();
manager.initialize();
module = new DummyRecoveryModule();
assertFalse(module.finished());
manager.addModule(module);
manager.scan();
assertTrue(module.finished());
}
use of com.arjuna.ats.arjuna.recovery.RecoveryManager in project narayana by jbosstm.
the class RecoveryManagerStartStopTest method testStartStop.
@Test
public void testStartStop() throws Exception {
recoveryPropertyManager.getRecoveryEnvironmentBean().setRecoveryPort(4712);
// check how many threads there are running
ThreadGroup thg = Thread.currentThread().getThreadGroup();
int activeCount = thg.activeCount();
dumpThreadGroup(thg, "Before recovery manager create");
RecoveryManager.delayRecoveryManagerThread();
RecoveryManager manager = RecoveryManager.manager(RecoveryManager.INDIRECT_MANAGEMENT);
dumpThreadGroup(thg, "Before recovery manager initialize");
manager.initialize();
dumpThreadGroup(thg, "Before recovery manager start periodic recovery thread");
manager.startRecoveryManagerThread();
dumpThreadGroup(thg, "Before recovery manager client create");
// Thread.sleep(1000);
// we need to open several connections to the recovery manager listener service and then
// ensure they get closed down
addRecoveryClient();
addRecoveryClient();
dumpThreadGroup(thg, "Before recovery manager terminate");
manager.terminate();
// ensure the client threads get killed
ensureRecoveryClientsTerminated();
dumpThreadGroup(thg, "After recovery manager terminate");
int newActiveCount = thg.activeCount();
assertEquals(activeCount, newActiveCount);
}
Aggregations