Search in sources :

Example 21 with IntHolder

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);
    }
}
Also used : IntHolder(org.omg.CORBA.IntHolder)

Example 22 with IntHolder

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);
    }
}
Also used : IntHolder(org.omg.CORBA.IntHolder)

Example 23 with IntHolder

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);
    }
}
Also used : IntHolder(org.omg.CORBA.IntHolder)

Example 24 with IntHolder

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);
}
Also used : Control(org.omg.CosTransactions.Control) IntHolder(org.omg.CORBA.IntHolder)

Example 25 with IntHolder

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);
}
Also used : Control(org.omg.CosTransactions.Control) IntHolder(org.omg.CORBA.IntHolder)

Aggregations

IntHolder (org.omg.CORBA.IntHolder)72 AtomicTransaction (com.arjuna.ats.jts.extensions.AtomicTransaction)12 Control (org.omg.CosTransactions.Control)10 ORB (com.arjuna.orbportability.ORB)6 RootOA (com.arjuna.orbportability.RootOA)6 HitCountRequest (org.codice.alliance.nsili.common.GIAS.HitCountRequest)6 Services (com.arjuna.orbportability.Services)5 ServerORB (com.hp.mwtests.ts.jts.utils.ServerORB)5 AcsJCORBAProblemEx (alma.ACSErrTypeCommon.wrappers.AcsJCORBAProblemEx)4 NameAlreadyUsed (gov.sandia.NotifyMonitoringExt.NameAlreadyUsed)3 NameMapError (gov.sandia.NotifyMonitoringExt.NameMapError)3 Test (org.junit.Test)3 BAD_PARAM (org.omg.CORBA.BAD_PARAM)3 AdminLimitExceeded (org.omg.CosNotifyChannelAdmin.AdminLimitExceeded)3 AcsJNarrowFailedEx (alma.ACSErrTypeCORBA.wrappers.AcsJNarrowFailedEx)2 CurrentImple (com.arjuna.ats.internal.jts.orbspecific.CurrentImple)2 SubmitQueryRequest (org.codice.alliance.nsili.common.GIAS.SubmitQueryRequest)2 DAGListHolder (org.codice.alliance.nsili.common.UCO.DAGListHolder)2 InvalidInputParameter (org.codice.alliance.nsili.common.UCO.InvalidInputParameter)2 ProcessingFault (org.codice.alliance.nsili.common.UCO.ProcessingFault)2