use of com.arjuna.ats.arjuna.AtomicAction in project narayana by jbosstm.
the class PerformanceTest2 method recoverableTest.
@Test
public void recoverableTest() {
long iters = 1000;
RecoverableObject foo = new RecoverableObject();
AtomicAction A = null;
long t1 = System.currentTimeMillis();
for (int c = 0; c < iters; c++) {
A = new AtomicAction();
A.begin();
foo.set(2);
A.commit();
}
reportThroughput("recoverableTest", iters, t1);
}
use of com.arjuna.ats.arjuna.AtomicAction in project narayana by jbosstm.
the class PerformanceTest2 method persistentTest.
@Test
public void persistentTest() {
long iters = 1000;
AtomicObject foo = new AtomicObject();
AtomicAction A = null;
long t1 = System.currentTimeMillis();
try {
for (int c = 0; c < iters; c++) {
A = new AtomicAction();
A.begin();
foo.set(2);
A.commit();
}
} catch (TestException e) {
if (A != null)
A.abort();
fail("AtomicObject exception raised.");
}
reportThroughput("persistentTest", iters, t1);
}
use of com.arjuna.ats.arjuna.AtomicAction in project narayana by jbosstm.
the class PerformanceTest1 method recoverableTest.
@Test
public void recoverableTest() {
long iters = 4;
RecoverableObject foo = new RecoverableObject();
AtomicAction A = new AtomicAction();
long t1 = System.currentTimeMillis();
A.begin();
for (int c = 0; c < iters; c++) {
foo.set(2);
}
A.commit();
reportThroughput("recoverableTest", iters, t1);
}
use of com.arjuna.ats.arjuna.AtomicAction in project narayana by jbosstm.
the class RecoveryTest method testCommit.
@Test
public void testCommit() throws Exception {
AtomicAction A = new AtomicAction();
A.begin();
AtomicObject obj = new AtomicObject();
OutputObjectState os = new OutputObjectState();
Uid u = new Uid();
assertTrue(obj.save_state(os, ObjectType.ANDPERSISTENT));
assertTrue(StoreManager.getParticipantStore().write_uncommitted(u, obj.type(), os));
MyRecoveredTO rto = new MyRecoveredTO(u, obj.type(), StoreManager.getParticipantStore());
rto.replay();
A.abort();
}
use of com.arjuna.ats.arjuna.AtomicAction in project narayana by jbosstm.
the class AtomicObjectTest1 method incr12.
private static void incr12(char thr, int level) {
boolean res = true;
boolean res1 = true;
boolean res2 = true;
int ran;
AtomicAction a = new AtomicAction();
a.begin();
indent(thr, level);
System.out.println("begin incr12");
ran = Math.abs(rand.nextInt()) % 16;
try {
atomicObject1.incr(ran);
} catch (TestException e) {
res = res1 = false;
}
indent(thr, level);
System.out.println("part1 incr12 : " + res1);
if (res) {
try {
atomicObject2.incr(-ran);
} catch (TestException e) {
res = res2 = false;
}
indent(thr, level);
System.out.println("part2 incr12 : " + res2);
} else
res2 = false;
indent(thr, level);
if (res) {
System.out.print("commit ");
res = (boolean) (a.commit() == ActionStatus.COMMITTED);
} else {
System.out.print("abort ");
a.abort();
}
System.out.println(" incr12 : " + res1 + " : " + res2 + " : " + res + " : " + ran);
}
Aggregations