use of org.omg.CosTransactions.Control in project narayana by jbosstm.
the class DistributedHammerWorker3 method get1.
public static boolean get1(IntHolder value) {
boolean res = false;
try {
OTSImpleManager.current().begin();
Control control = OTSImpleManager.current().get_control();
res = hammerObject_1.get(value, control);
control = null;
if (res) {
OTSImpleManager.current().commit(true);
} else {
OTSImpleManager.current().rollback();
}
} catch (Exception e) {
System.err.println("DistributedHammerWorker1.get1: " + e);
res = false;
}
return (res);
}
use of org.omg.CosTransactions.Control in project narayana by jbosstm.
the class DistributedHammerWorker3 method get21.
public static void get21(int thr, int level) {
boolean res = false;
boolean res1 = false;
boolean res2 = false;
IntHolder value1 = new IntHolder(0);
IntHolder value2 = new IntHolder(0);
try {
OTSImpleManager.current().begin();
Control control = OTSImpleManager.current().get_control();
Util.indent(thr, level);
System.out.println("begin get21");
res1 = hammerObject_2.get(value1, control);
res = res1;
Util.indent(thr, level);
System.out.println("part1 get21 : " + res1);
Util.lowProbYield();
if (res) {
res2 = hammerObject_1.get(value2, control);
res = res2;
Util.indent(thr, level);
System.out.println("part2 get21 : " + res2);
}
Util.lowProbYield();
control = null;
Util.indent(thr, level);
if (res) {
System.out.print("end ");
OTSImpleManager.current().commit(true);
} else {
System.out.print("abort ");
OTSImpleManager.current().rollback();
}
} catch (Exception e) {
System.err.println("DistributedHammerWorker3.get21: " + e);
res1 = res2 = res = false;
}
Util.indent(thr, level);
System.out.println(" get21 : " + res1 + " : " + res2 + " : " + res + " : " + value1.value + " : " + value2.value);
}
use of org.omg.CosTransactions.Control in project narayana by jbosstm.
the class Test22 method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
boolean correct = true;
Current current = OTS.get_current();
current.begin();
current.commit(true);
Control control = current.suspend();
correct = (control == null);
if (correct) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Test22.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Test22.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of org.omg.CosTransactions.Control in project narayana by jbosstm.
the class Test24 method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
boolean correct = true;
Current current = OTS.get_current();
current.begin();
current.rollback();
Control control = current.suspend();
correct = (control == null);
if (correct) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Test24.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Test24.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of org.omg.CosTransactions.Control in project narayana by jbosstm.
the class Test26 method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
boolean correct = true;
Current current = OTS.get_current();
current.begin();
Control control = current.get_control();
current.commit(true);
try {
current.resume(control);
} catch (InvalidControl invalidControl) {
System.err.println("Failed to resume committed transaction!");
correct = false;
}
if (correct) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Test26.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Test26.main: " + exception);
exception.printStackTrace(System.err);
}
}
Aggregations