use of com.arjuna.ats.arjuna.recovery.RecoveryManager in project wildfly by wildfly.
the class InboundBridgeService method removeRecoveryModule.
private void removeRecoveryModule() {
if (recoveryModule == null) {
return;
}
final RecoveryManager recoveryManager = RecoveryManager.manager();
recoveryManager.removeModule(recoveryModule, false);
}
use of com.arjuna.ats.arjuna.recovery.RecoveryManager in project wildfly by wildfly.
the class InboundBridgeService method addRecoveryModule.
private void addRecoveryModule() {
final RecoveryManager recoveryManager = RecoveryManager.manager();
recoveryModule = new InboundBridgeRecoveryModule();
recoveryManager.addModule(recoveryModule);
}
use of com.arjuna.ats.arjuna.recovery.RecoveryManager in project narayana by jbosstm.
the class CrashRecovery2 method testRmFailXAResourceSerializable.
/**
* Test of top-down recovery with serializable XAResource.
*/
@Test
public void testRmFailXAResourceSerializable() throws Exception {
recoveryPropertyManager.getRecoveryEnvironmentBean().setRecoveryBackoffPeriod(1);
TestXAResource firstResource = new TestXAResourceRmFail().clearCounters();
TestXAResource secondResource = new TestXAResource();
javax.transaction.TransactionManager tm = com.arjuna.ats.jta.TransactionManager.transactionManager();
tm.begin();
javax.transaction.Transaction theTransaction = tm.getTransaction();
theTransaction.enlistResource(firstResource);
theTransaction.enlistResource(secondResource);
tm.commit();
assertEquals("first resource failed with rmfail, no commit expected", 0, firstResource.commitCount());
assertEquals("second resource should be committed", 1, secondResource.commitCount());
assertEquals("first resource: no rollback expected on rmfail", 0, firstResource.rollbackCount());
assertEquals("second resource: expected to be committed", 0, secondResource.rollbackCount());
RecoveryManager manager = RecoveryManager.manager(RecoveryManager.DIRECT_MANAGEMENT);
manager.initialize();
manager.scan();
assertEquals("no rollback expecte on first resource", 0, firstResource.rollbackCount());
assertEquals("no rollback expecte on second resource", 0, secondResource.rollbackCount());
assertEquals("serializable first resource should be committed on recovery", 1, firstResource.commitCount());
assertEquals("second resource should be already committed even without recovery", 1, secondResource.commitCount());
}
use of com.arjuna.ats.arjuna.recovery.RecoveryManager in project narayana by jbosstm.
the class LogStoreRecoveryTest2 method test.
@Test
public void test() {
int threads = 10;
int work = 100;
recoveryPropertyManager.getRecoveryEnvironmentBean().setRecoveryBackoffPeriod(1);
arjPropertyManager.getCoordinatorEnvironmentBean().setCommitOnePhase(false);
arjPropertyManager.getObjectStoreEnvironmentBean().setObjectStoreType(LogStore.class.getName());
arjPropertyManager.getObjectStoreEnvironmentBean().setSynchronousRemoval(false);
// the byteman script will enforce this
// System.setProperty(Environment.TRANSACTION_LOG_PURGE_TIME, "1000000"); // essentially infinite
TestWorker[] workers = new TestWorker[threads];
for (int i = 0; i < threads; i++) {
workers[i] = new TestWorker(work);
workers[i].start();
}
for (int j = 0; j < threads; j++) {
try {
workers[j].join();
System.err.println("**terminated " + j);
} catch (final Exception ex) {
}
}
/*
* Now have a log that hasn't been deleted. Run recovery and see
* what happens!
*/
RecoveryManager manager = RecoveryManager.manager(RecoveryManager.DIRECT_MANAGEMENT);
manager.scan();
}
use of com.arjuna.ats.arjuna.recovery.RecoveryManager in project narayana by jbosstm.
the class CallbackRecoveryTest method test.
@Test
public void test() {
recoveryPropertyManager.getRecoveryEnvironmentBean().setRecoveryBackoffPeriod(1);
RecoveryManager manager = RecoveryManager.manager(RecoveryManager.DIRECT_MANAGEMENT);
DummyRecoveryModule module = new DummyRecoveryModule();
RecoveryScanImple rs = new RecoveryScanImple();
// make sure no other modules registered for this test
manager.removeAllModules(false);
manager.addModule(module);
manager.scan(rs);
/*
* the 30 second wait timeout here is just in case something is not working. the scan should
* finish almost straight away
*/
rs.waitForCompleted(30 * 1000);
assertTrue(module.finished());
assertTrue(rs.passed);
}
Aggregations