use of com.arjuna.ats.arjuna.common.Uid in project narayana by jbosstm.
the class AITMatrixImpl04 method restore_state.
public boolean restore_state(InputObjectState objectState, int objectType) {
super.restore_state(objectState, objectType);
try {
for (int x = 0; x < _width; x++) {
for (int y = 0; y < _height; y++) {
Uid uid = UidHelper.unpackFrom(objectState);
_values[x][y] = Element.obtain(uid);
}
}
return true;
} catch (Exception exception) {
System.err.println("AITMatrixImpl04.restore_state: " + exception);
return false;
}
}
use of com.arjuna.ats.arjuna.common.Uid in project narayana by jbosstm.
the class AITMatrixImpl04 method restore_state.
public boolean restore_state(InputObjectState objectState, int objectType) {
super.restore_state(objectState, objectType);
try {
for (int x = 0; x < _width; x++) {
for (int y = 0; y < _height; y++) {
Uid uid = UidHelper.unpackFrom(objectState);
_values[x][y] = Element.obtain(uid);
}
}
return true;
} catch (Exception exception) {
System.err.println("AITMatrixImpl04.restore_state: " + exception);
return false;
}
}
use of com.arjuna.ats.arjuna.common.Uid in project narayana by jbosstm.
the class TransactionLog method getIds.
/**
* Get a list object ids for a given object type
*
* @param ids holder for the returned uids
* @param objectType The type of object to search in the recoveryStore for
* @return all objects of the given type
* @throws ObjectStoreException the recoveryStore implementation was unable retrieve all types of objects
*/
public Collection<Uid> getIds(Collection<Uid> ids, String objectType) throws ObjectStoreException {
if (ids == null)
ids = new ArrayList<Uid>();
InputObjectState types = new InputObjectState();
if (recoveryStore.allTypes(types)) {
String theName;
try {
boolean endOfList = false;
while (!endOfList) {
theName = types.unpackString();
if (theName.compareTo("") == 0)
endOfList = true;
else {
if (objectType != null && !theName.equals(objectType))
continue;
InputObjectState uids = new InputObjectState();
if (recoveryStore.allObjUids(theName, uids)) {
Uid theUid = new Uid(Uid.nullUid());
try {
boolean endOfUids = false;
while (!endOfUids) {
theUid = UidHelper.unpackFrom(uids);
if (theUid.equals(Uid.nullUid()))
endOfUids = true;
else
ids.add(theUid);
}
} catch (Exception e) {
// end of uids!
}
}
System.out.println();
}
}
} catch (Exception e) {
System.err.println(e);
// end of list!
}
}
return ids;
}
use of com.arjuna.ats.arjuna.common.Uid in project narayana by jbosstm.
the class ObjectUidStore method loadUid.
public static Uid loadUid(String objectName) throws Exception {
Uid objectUid = null;
Properties objectUids = new Properties();
FileInputStream objectUidsFileInputStream = new FileInputStream("ObjectUids");
objectUids.load(objectUidsFileInputStream);
objectUidsFileInputStream.close();
objectUid = new Uid((String) objectUids.get(objectName));
return objectUid;
}
use of com.arjuna.ats.arjuna.common.Uid in project narayana by jbosstm.
the class ParticipantsManagerTestCase method testReportHeuristic.
@Test
public void testReportHeuristic() throws MalformedURLException {
final String participantId = new Uid().toString();
registerParticipant(participantId, new LoggingParticipant(new Prepared()));
final ParticipantInformation participantInformation = ParticipantsContainer.getInstance().getParticipantInformation(participantId);
participantInformation.setStatus(TxStatus.TransactionPrepared.name());
participantsManager.reportHeuristic(participantId, HeuristicType.HEURISTIC_ROLLBACK);
Assert.assertEquals(TxStatus.TransactionHeuristicRollback.name(), participantInformation.getStatus());
}
Aggregations