use of com.arjuna.ats.arjuna.state.InputObjectState in project narayana by jbosstm.
the class ObjectStoreAPIJMXTest method testShadowNoFileLockStore.
@Test
public void testShadowNoFileLockStore() throws Exception {
final OutputObjectState buff = new OutputObjectState();
final String tn = "/StateManager/junit";
System.out.println("Testing shadow file store");
for (int i = 0; i < 10; i++) {
Uid u = new Uid();
pps.write_uncommitted(u, tn, buff);
pps.commit_state(u, tn);
assertTrue(prs.currentState(u, tn) != StateStatus.OS_UNCOMMITTED);
InputObjectState ios = new InputObjectState();
prs.allObjUids("", ios);
assertTrue(pps.read_uncommitted(u, tn) == null);
prs.write_committed(u, tn, buff);
prs.read_committed(u, tn);
assertTrue(!pps.remove_uncommitted(u, tn));
prs.remove_committed(u, tn);
assertTrue(!prs.hide_state(u, tn));
assertTrue(!prs.reveal_state(u, tn));
}
}
use of com.arjuna.ats.arjuna.state.InputObjectState in project narayana by jbosstm.
the class XARecoveryModule method periodicWorkFirstPass.
private synchronized void periodicWorkFirstPass(ScanStates endState) {
// then we get deadlock on the secondpass
if (getScanState() == ScanStates.BETWEEN_PASSES) {
periodicWorkSecondPass();
// Ensure if originally we are between periodic recovery scans we continue in that state and leave XAResource in STARTRSCAN
endState = ScanStates.BETWEEN_PASSES;
}
// synchronized uses a reentrant lock
setScanState(ScanStates.FIRST_PASS);
if (jtaLogger.logger.isDebugEnabled()) {
jtaLogger.logger.debugv("{0} - first pass", _logName);
}
contactedJndiNames.clear();
_uids = new InputObjectState();
try {
if (!_recoveryStore.allObjUids(_recoveryManagerClass.type(), _uids)) {
jtaLogger.i18NLogger.warn_recovery_alluids();
}
} catch (ObjectStoreException e) {
jtaLogger.i18NLogger.warn_recovery_objstoreerror(e);
} catch (Exception e) {
jtaLogger.i18NLogger.warn_recovery_periodicfirstpass(_logName + ".periodicWorkFirstPass", e);
}
// JBTM-1354 JCA needs to be able to recover XAResources associated with a subordinate transaction so we have to do at least
// the start scan to make sure that we have loaded all the XAResources we possibly can to assist subordinate transactions recovering
// scan using statically configured plugins;
_resources = resourceInitiatedRecovery();
// scan using dynamically configured plugins:
_resources.addAll(resourceInitiatedRecoveryForRecoveryHelpers());
List<XAResource> resources = new ArrayList<XAResource>(_resources);
for (XAResource xaResource : resources) {
try {
xaRecoveryFirstPass(xaResource);
} catch (Exception ex) {
jtaLogger.i18NLogger.warn_recovery_getxaresource(ex);
}
}
if (endState != ScanStates.BETWEEN_PASSES) {
for (XAResource xaResource : resources) {
try {
xaResource.recover(XAResource.TMENDRSCAN);
} catch (Exception ex) {
jtaLogger.i18NLogger.warn_recovery_getxaresource(ex);
}
}
}
setScanState(endState);
}
use of com.arjuna.ats.arjuna.state.InputObjectState in project narayana by jbosstm.
the class RecoverConnectableAtomicActionBean method createWrapper.
@Override
protected ActionBeanWrapperInterface createWrapper(UidWrapper w, boolean activate) {
try {
InputObjectState state = StoreManager.getRecoveryStore().read_committed(w.getUid(), RecoverConnectableAtomicAction.CONNECTABLE_ATOMIC_ACTION_TYPE);
connectableAtomicAction = new RecoverConnectableAtomicAction(RecoverConnectableAtomicAction.CONNECTABLE_ATOMIC_ACTION_TYPE, w.getUid(), state);
} catch (ObjectStoreException e) {
;
} catch (IOException e) {
;
}
GenericAtomicActionWrapper action = new GenericAtomicActionWrapper(connectableAtomicAction, w);
if (activate)
action.activate();
return action;
}
use of com.arjuna.ats.arjuna.state.InputObjectState in project narayana by jbosstm.
the class XAResourceRecordUnitTest method testPackUnpack.
@Test
public void testPackUnpack() throws Exception {
ThreadActionData.purgeActions();
OTSImpleManager.current().contextManager().purgeActions();
XAResourceRecord xares;
DummyRecoverableXAConnection rc = new DummyRecoverableXAConnection();
Object[] params = new Object[1];
params[XAResourceRecord.XACONNECTION] = rc;
xares = new XAResourceRecord(new TransactionImple(), new DummyXA(false), new XidImple(new Uid()), params);
OutputObjectState os = new OutputObjectState();
assertTrue(xares.saveState(os));
xares = new XAResourceRecord();
InputObjectState is = new InputObjectState(os);
assertTrue(xares.restoreState(is));
}
use of com.arjuna.ats.arjuna.state.InputObjectState in project narayana by jbosstm.
the class ServerTransactionUnitTest method test.
@Test
public void test() throws Exception {
ServerTransaction st = new ServerTransaction(new Uid(), new XidImple(new Uid()));
OutputObjectState os = new OutputObjectState();
assertTrue(st.save_state(os, ObjectType.ANDPERSISTENT));
InputObjectState is = new InputObjectState(os);
assertTrue(st.restore_state(is, ObjectType.ANDPERSISTENT));
}
Aggregations