use of org.omg.CORBA.IntHolder in project narayana by jbosstm.
the class Outcome02 method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
int expectedValue = Integer.parseInt(args[args.length - 3]);
String counterIOR1 = ServerIORStore.loadIOR(args[args.length - 2]);
Counter counter1 = CounterHelper.narrow(ORBInterface.orb().string_to_object(counterIOR1));
String counterIOR2 = ServerIORStore.loadIOR(args[args.length - 1]);
Counter counter2 = CounterHelper.narrow(ORBInterface.orb().string_to_object(counterIOR2));
IntHolder value1 = new IntHolder();
counter1.get(value1);
IntHolder value2 = new IntHolder();
counter2.get(value2);
if ((value1.value == expectedValue) && (value2.value == expectedValue)) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Outcome02.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Outcome02.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of org.omg.CORBA.IntHolder in project narayana by jbosstm.
the class Client01 method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
String counterIOR = ServerIORStore.loadIOR(args[args.length - 1]);
Counter counter = CounterHelper.narrow(ORBInterface.orb().string_to_object(counterIOR));
int numberOfCalls = 1000;
for (int index = 0; index < numberOfCalls; index++) {
counter.increase(null);
}
IntHolder value = new IntHolder();
counter.get(value, null);
if (value.value == numberOfCalls) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Client01.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Client01.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of org.omg.CORBA.IntHolder in project narayana by jbosstm.
the class Client11 method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
String pingerIOR = ServerIORStore.loadIOR(args[args.length - 2]);
PingPong pinger = PingPongHelper.narrow(ORBInterface.orb().string_to_object(pingerIOR));
String pongerIOR = ServerIORStore.loadIOR(args[args.length - 1]);
PingPong ponger = PingPongHelper.narrow(ORBInterface.orb().string_to_object(pongerIOR));
int numberOfCalls = 10;
for (int index0 = 0; index0 < numberOfCalls; index0++) {
for (int index1 = 0; index1 <= index0; index1++) {
pinger.bad_hit(index0, index1, ponger, pinger, null);
}
}
IntHolder pingerValue = new IntHolder();
pinger.get(pingerValue, null);
IntHolder pongerValue = new IntHolder();
ponger.get(pongerValue, null);
if ((pingerValue.value == 0) && (pongerValue.value == 0)) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Client11.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Client11.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of org.omg.CORBA.IntHolder in project narayana by jbosstm.
the class DistributedHammerWorker2 method get21.
public static void get21(char 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("DistributedHammerWorker2.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.CORBA.IntHolder in project narayana by jbosstm.
the class DistributedHammerWorker2 method get12.
public static void get12(char 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 get12");
res1 = hammerObject_1.get(value1, control);
res = res1;
Util.indent(thr, level);
System.out.println("part1 get12 : " + res1);
Util.lowProbYield();
if (res) {
res2 = hammerObject_2.get(value2, control);
res = res2;
Util.indent(thr, level);
System.out.println("part2 get12 : " + 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("DistributedHammerWorker2.get12: " + e);
res1 = res2 = res = false;
}
Util.indent(thr, level);
System.out.println(" get12 : " + res1 + " : " + res2 + " : " + res + " : " + value1.value + " : " + value2.value);
}
Aggregations