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();
}
IntHolder value = new IntHolder();
counter.get(value);
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 Client05 method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
String pingPongIOR = ServerIORStore.loadIOR(args[args.length - 1]);
PingPong pingPong = PingPongHelper.narrow(ORBInterface.orb().string_to_object(pingPongIOR));
int numberOfCalls = 10;
for (int index = 0; index < numberOfCalls; index++) {
pingPong.hit(index, pingPong, pingPong);
}
IntHolder pingPongValue = new IntHolder();
pingPong.get(pingPongValue);
if (pingPongValue.value == numberOfCalls) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Client05.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Client05.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of org.omg.CORBA.IntHolder in project narayana by jbosstm.
the class Outcome01 method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
int expectedValue = Integer.parseInt(args[args.length - 2]);
String counterIOR = ServerIORStore.loadIOR(args[args.length - 1]);
Counter counter = CounterHelper.narrow(ORBInterface.orb().string_to_object(counterIOR));
IntHolder value = new IntHolder();
counter.get(value, null);
if (value.value == expectedValue) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Outcome01.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Outcome01.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of org.omg.CORBA.IntHolder in project narayana by jbosstm.
the class Client14 method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
String counterIOR = ServerIORStore.loadIOR(args[args.length - 3]);
Counter counter = CounterHelper.narrow(ORBInterface.orb().string_to_object(counterIOR));
int numberOfWorkers = Integer.parseInt(args[args.length - 2]);
int numberOfCalls = Integer.parseInt(args[args.length - 1]);
Worker[] workers = new Worker[numberOfWorkers];
for (int index = 0; index < workers.length; index++) {
workers[index] = new Worker(numberOfCalls, counter);
}
for (int index = 0; index < workers.length; index++) {
workers[index].start();
}
boolean correct = true;
for (int index = 0; index < workers.length; index++) {
workers[index].join();
correct = correct && workers[index].isCorrect();
}
IntHolder value = new IntHolder();
counter.get(value, null);
correct = correct && (value.value == (numberOfWorkers * numberOfCalls));
if (correct) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Client14.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Client14.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of org.omg.CORBA.IntHolder in project narayana by jbosstm.
the class Client16 method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
String counterIOR = ServerIORStore.loadIOR(args[args.length - 3]);
Counter counter = CounterHelper.narrow(ORBInterface.orb().string_to_object(counterIOR));
int numberOfWorkers = Integer.parseInt(args[args.length - 2]);
int numberOfCalls = Integer.parseInt(args[args.length - 1]);
Worker[] workers = new Worker[numberOfWorkers];
for (int index = 0; index < workers.length; index++) {
workers[index] = new Worker(numberOfCalls, counter);
}
for (int index = 0; index < workers.length; index++) {
workers[index].start();
}
boolean correct = true;
for (int index = 0; index < workers.length; index++) {
workers[index].join();
correct = correct && workers[index].isCorrect();
}
IntHolder value = new IntHolder();
AtomicTransaction atomicTransaction = new AtomicTransaction();
atomicTransaction.begin();
counter.get(value, OTS.current().get_control());
atomicTransaction.commit(true);
correct = correct && (value.value == (numberOfWorkers * numberOfCalls));
if (correct) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Client16.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Client16.main: " + exception);
exception.printStackTrace(System.err);
}
}
Aggregations