use of com.arjuna.ats.arjuna.state.InputObjectState in project narayana by jbosstm.
the class LockManagerProxyUnitTest method testBasicSaveRestore.
public void testBasicSaveRestore() {
BasicLockable sample = new BasicLockable();
LockManagerProxy<BasicLockable> proxy = new LockManagerProxy<BasicLockable>(sample);
OutputObjectState os = new OutputObjectState();
assertNotNull(proxy.type());
assertTrue(proxy.save_state(os, ObjectType.RECOVERABLE));
InputObjectState ios = new InputObjectState(os);
sample._isState = -1;
sample._isNotState = -1;
assertTrue(proxy.restore_state(ios, ObjectType.RECOVERABLE));
assertTrue(sample._isState == 4);
assertTrue(sample._isNotState == -1);
}
use of com.arjuna.ats.arjuna.state.InputObjectState in project narayana by jbosstm.
the class LockManagerProxyUnitTest method testExtendedSaveRestore.
public void testExtendedSaveRestore() {
ExtendedLockable sample = new ExtendedLockable();
LockManagerProxy<ExtendedLockable> proxy = new LockManagerProxy<ExtendedLockable>(sample);
OutputObjectState os = new OutputObjectState();
assertNotNull(proxy.type());
assertTrue(proxy.save_state(os, ObjectType.RECOVERABLE));
InputObjectState ios = new InputObjectState(os);
sample._isState = new Double(0.0);
sample._isNotState = new Integer(0);
sample.set("");
assertTrue(proxy.restore_state(ios, ObjectType.RECOVERABLE));
assertTrue(sample._isState.doubleValue() == 1.234);
assertTrue(sample._isNotState.intValue() == 0);
assertEquals(sample.get(), "Hello World");
}
use of com.arjuna.ats.arjuna.state.InputObjectState in project narayana by jbosstm.
the class SubordinateBACoordinatorRecoveryModule method periodicWorkFirstPass.
/**
* This is called periodically by the RecoveryManager
*/
public void periodicWorkFirstPass() {
// Transaction type
boolean SubordinateCoordinators = false;
// uids per transaction type
InputObjectState acc_uids = new InputObjectState();
try {
if (RecoveryLogger.logger.isDebugEnabled()) {
RecoveryLogger.logger.debug("StatusModule: first pass ");
}
SubordinateCoordinators = _recoveryStore.allObjUids(_transactionType, acc_uids);
} catch (ObjectStoreException ex) {
RecoveryLogger.i18NLogger.warn_coordinator_ba_SubordinateCoordinatorRecoveryModule_1(ex);
}
if (SubordinateCoordinators) {
_transactionUidVector = processTransactions(acc_uids);
}
}
use of com.arjuna.ats.arjuna.state.InputObjectState in project narayana by jbosstm.
the class ATParticipantRecoveryModule method periodicWorkFirstPass.
/**
* This is called periodically by the RecoveryManager
*/
public void periodicWorkFirstPass() {
// Transaction type
boolean ATParticipants = false;
// uids per transaction type
InputObjectState acc_uids = new InputObjectState();
try {
if (RecoveryLogger.logger.isDebugEnabled()) {
RecoveryLogger.logger.debug("ATParticipantRecoveryModule: first pass");
}
ATParticipants = _recoveryStore.allObjUids(_participantType, acc_uids);
} catch (ObjectStoreException ex) {
RecoveryLogger.i18NLogger.warn_participant_at_ATParticipantRecoveryModule_1(ex);
}
if (ATParticipants) {
_participantUidVector = processParticipants(acc_uids);
}
}
use of com.arjuna.ats.arjuna.state.InputObjectState in project narayana by jbosstm.
the class TransactionStatusConnectionManager method updateTSMI.
/**
* Examine the Object Store for any new TrasactionStatusManagerItem
* objects, and add to local hash table.
*/
public void updateTSMI() {
boolean tsmis = false;
InputObjectState uids = new InputObjectState();
Vector tsmiVector = new Vector();
try {
tsmis = _recoveryStore.allObjUids(_typeName, uids);
} catch (ObjectStoreException ex) {
tsLogger.i18NLogger.warn_recovery_TransactionStatusConnectionManager_2(ex);
}
if (tsmis) {
Uid theUid = null;
boolean moreUids = true;
while (moreUids) {
try {
theUid = UidHelper.unpackFrom(uids);
if (theUid.equals(Uid.nullUid())) {
moreUids = false;
} else {
Uid newUid = new Uid(theUid);
if (tsLogger.logger.isDebugEnabled()) {
tsLogger.logger.debug("found process uid " + newUid);
}
tsmiVector.addElement(newUid);
}
} catch (Exception ex) {
moreUids = false;
}
}
}
// for each TransactionStatusManager found, if their is
// not an entry in the local hash table for it then add it.
Enumeration tsmiEnum = tsmiVector.elements();
while (tsmiEnum.hasMoreElements()) {
Uid currentUid = (Uid) tsmiEnum.nextElement();
String process_id = currentUid.getHexPid();
if (!_tscTable.containsKey(process_id)) {
TransactionStatusConnector tsc = new TransactionStatusConnector(process_id, currentUid);
if (tsc.isDead()) {
tsc.delete();
tsc = null;
} else {
_tscTable.put(process_id, tsc);
}
if (tsLogger.logger.isDebugEnabled()) {
tsLogger.logger.debug("added TransactionStatusConnector to table for process uid " + process_id);
}
}
}
}
Aggregations