Search in sources :

Example 16 with AtomicTransaction

use of com.arjuna.ats.jts.extensions.AtomicTransaction in project narayana by jbosstm.

the class Client_ImplicitObject_TranRollback_TranRollbackNullOper method main.

public static void main(String[] args) {
    try {
        ORBInterface.initORB(args, null);
        OAInterface.initOA();
        String prefix = args[args.length - 3];
        int numberOfCalls = Integer.parseInt(args[args.length - 2]);
        String implicitObjectIOR = ServerIORStore.loadIOR(args[args.length - 1]);
        ImplicitObject implicitObject = ImplicitObjectHelper.narrow(ORBInterface.orb().string_to_object(implicitObjectIOR));
        boolean correct = true;
        Date start = new Date();
        for (int index = 0; index < numberOfCalls; index++) {
            AtomicTransaction atomicTransaction = new AtomicTransaction();
            atomicTransaction.begin();
            implicitObject.tran_rollback_nulloper();
            atomicTransaction.rollback();
        }
        Date end = new Date();
        float operationDuration = ((float) (end.getTime() - start.getTime())) / ((float) numberOfCalls);
        System.err.println("Operation duration       : " + operationDuration + "ms");
        System.err.println("Test duration            : " + (end.getTime() - start.getTime()) + "ms");
        correct = PerformanceProfileStore.checkPerformance(prefix + "_ImplicitObject_TranRollback_TranRollbackNullOper", operationDuration);
        if (correct) {
            System.out.println("Passed");
        } else {
            System.out.println("Failed");
        }
    } catch (Exception exception) {
        System.out.println("Failed");
        System.err.println("Client_ImplicitObject_TranRollback_TranRollbackNullOper.main: " + exception);
        exception.printStackTrace(System.err);
    }
    try {
        OAInterface.shutdownOA();
        ORBInterface.shutdownORB();
    } catch (Exception exception) {
        System.err.println("Client_ImplicitObject_TranRollback_TranRollbackNullOper.main: " + exception);
        exception.printStackTrace(System.err);
    }
}
Also used : AtomicTransaction(com.arjuna.ats.jts.extensions.AtomicTransaction) Date(java.util.Date)

Example 17 with AtomicTransaction

use of com.arjuna.ats.jts.extensions.AtomicTransaction in project narayana by jbosstm.

the class Client_ImplicitObject_TranRollback_TranRollbackWriteLock method main.

public static void main(String[] args) {
    try {
        ORBInterface.initORB(args, null);
        OAInterface.initOA();
        String prefix = args[args.length - 3];
        int numberOfCalls = Integer.parseInt(args[args.length - 2]);
        String implicitObjectIOR = ServerIORStore.loadIOR(args[args.length - 1]);
        ImplicitObject implicitObject = ImplicitObjectHelper.narrow(ORBInterface.orb().string_to_object(implicitObjectIOR));
        boolean correct = true;
        Date start = new Date();
        for (int index = 0; index < numberOfCalls; index++) {
            AtomicTransaction atomicTransaction = new AtomicTransaction();
            atomicTransaction.begin();
            implicitObject.tran_rollback_writelock();
            atomicTransaction.rollback();
        }
        Date end = new Date();
        float operationDuration = ((float) (end.getTime() - start.getTime())) / ((float) numberOfCalls);
        System.err.println("Operation duration       : " + operationDuration + "ms");
        System.err.println("Test duration            : " + (end.getTime() - start.getTime()) + "ms");
        correct = PerformanceProfileStore.checkPerformance(prefix + "_ImplicitObject_TranRollback_TranRollbackWriteLock", operationDuration);
        if (correct) {
            System.out.println("Passed");
        } else {
            System.out.println("Failed");
        }
    } catch (Exception exception) {
        System.out.println("Failed");
        System.err.println("Client_ImplicitObject_TranRollback_TranRollbackWriteLock.main: " + exception);
        exception.printStackTrace(System.err);
    }
    try {
        OAInterface.shutdownOA();
        ORBInterface.shutdownORB();
    } catch (Exception exception) {
        System.err.println("Client_ImplicitObject_TranRollback_TranRollbackWriteLock.main: " + exception);
        exception.printStackTrace(System.err);
    }
}
Also used : AtomicTransaction(com.arjuna.ats.jts.extensions.AtomicTransaction) Date(java.util.Date)

Example 18 with AtomicTransaction

use of com.arjuna.ats.jts.extensions.AtomicTransaction in project narayana by jbosstm.

the class AITImplicitObjectImpl01 method tran_commit_nulloper.

public void tran_commit_nulloper() throws InvocationException {
    try {
        AtomicTransaction atomicTransaction = new AtomicTransaction();
        try {
            atomicTransaction.begin();
            atomicTransaction.commit(true);
        } catch (Exception exception) {
            System.err.println("AITImplicitObjectImpl01.tran_commit_nulloper: " + exception);
            if (atomicTransaction.get_status() == Status.StatusActive) {
                atomicTransaction.rollback();
            }
            throw new InvocationException();
        }
    } catch (InvocationException invocationException) {
        throw invocationException;
    } catch (Exception exception) {
        System.err.println("AITImplicitObjectImpl01.tran_commit_nulloper: " + exception);
        throw new InvocationException();
    }
}
Also used : AtomicTransaction(com.arjuna.ats.jts.extensions.AtomicTransaction)

Example 19 with AtomicTransaction

use of com.arjuna.ats.jts.extensions.AtomicTransaction in project narayana by jbosstm.

the class Client_ImplicitObject_TranCommit_NoTranNullOper method main.

public static void main(String[] args) {
    try {
        ORBInterface.initORB(args, null);
        OAInterface.initOA();
        String prefix = args[args.length - 3];
        int numberOfCalls = Integer.parseInt(args[args.length - 2]);
        String implicitObjectIOR = ServerIORStore.loadIOR(args[args.length - 1]);
        ImplicitObject implicitObject = ImplicitObjectHelper.narrow(ORBInterface.orb().string_to_object(implicitObjectIOR));
        boolean correct = true;
        Date start = new Date();
        for (int index = 0; index < numberOfCalls; index++) {
            AtomicTransaction atomicTransaction = new AtomicTransaction();
            atomicTransaction.begin();
            implicitObject.no_tran_nulloper();
            atomicTransaction.commit(true);
        }
        Date end = new Date();
        float operationDuration = ((float) (end.getTime() - start.getTime())) / ((float) numberOfCalls);
        System.err.println("Operation duration       : " + operationDuration + "ms");
        System.err.println("Test duration            : " + (end.getTime() - start.getTime()) + "ms");
        correct = PerformanceProfileStore.checkPerformance(prefix + "_ImplicitObject_TranCommit_NoTranNullOper", operationDuration);
        if (correct) {
            System.out.println("Passed");
        } else {
            System.out.println("Failed");
        }
    } catch (Exception exception) {
        System.out.println("Failed");
        System.err.println("Client_ImplicitObject_TranCommit_NoTranNullOper.main: " + exception);
        exception.printStackTrace(System.err);
    }
    try {
        OAInterface.shutdownOA();
        ORBInterface.shutdownORB();
    } catch (Exception exception) {
        System.err.println("Client_ImplicitObject_TranCommit_NoTranNullOper.main: " + exception);
        exception.printStackTrace(System.err);
    }
}
Also used : AtomicTransaction(com.arjuna.ats.jts.extensions.AtomicTransaction) Date(java.util.Date)

Example 20 with AtomicTransaction

use of com.arjuna.ats.jts.extensions.AtomicTransaction in project narayana by jbosstm.

the class Client_ImplicitObject_TranCommit_NoTranWriteLock method main.

public static void main(String[] args) {
    try {
        ORBInterface.initORB(args, null);
        OAInterface.initOA();
        String prefix = args[args.length - 3];
        int numberOfCalls = Integer.parseInt(args[args.length - 2]);
        String implicitObjectIOR = ServerIORStore.loadIOR(args[args.length - 1]);
        ImplicitObject implicitObject = ImplicitObjectHelper.narrow(ORBInterface.orb().string_to_object(implicitObjectIOR));
        boolean correct = true;
        Date start = new Date();
        for (int index = 0; index < numberOfCalls; index++) {
            AtomicTransaction atomicTransaction = new AtomicTransaction();
            atomicTransaction.begin();
            implicitObject.no_tran_writelock();
            atomicTransaction.commit(true);
        }
        Date end = new Date();
        float operationDuration = ((float) (end.getTime() - start.getTime())) / ((float) numberOfCalls);
        System.err.println("Operation duration       : " + operationDuration + "ms");
        System.err.println("Test duration            : " + (end.getTime() - start.getTime()) + "ms");
        correct = PerformanceProfileStore.checkPerformance(prefix + "_ImplicitObject_TranCommit_NoTranWriteLock", operationDuration);
        if (correct) {
            System.out.println("Passed");
        } else {
            System.out.println("Failed");
        }
    } catch (Exception exception) {
        System.out.println("Failed");
        System.err.println("Client_ImplicitObject_TranCommit_NoTranWriteLock.main: " + exception);
        exception.printStackTrace(System.err);
    }
    try {
        OAInterface.shutdownOA();
        ORBInterface.shutdownORB();
    } catch (Exception exception) {
        System.err.println("Client_ImplicitObject_TranCommit_NoTranWriteLock.main: " + exception);
        exception.printStackTrace(System.err);
    }
}
Also used : AtomicTransaction(com.arjuna.ats.jts.extensions.AtomicTransaction) Date(java.util.Date)

Aggregations

AtomicTransaction (com.arjuna.ats.jts.extensions.AtomicTransaction)101 Lock (com.arjuna.ats.txoj.Lock)38 Date (java.util.Date)36 IntHolder (org.omg.CORBA.IntHolder)12 JVMStats (org.jboss.jbossts.qa.Utils.JVMStats)9 Test (org.junit.Test)7 IOException (java.io.IOException)6 SystemException (org.omg.CORBA.SystemException)6 DemoResource (com.hp.mwtests.ts.jts.orbspecific.resources.DemoResource)3 ExplicitInterposition (com.arjuna.ats.jts.ExplicitInterposition)2 TopLevelTransaction (com.arjuna.ats.jts.extensions.TopLevelTransaction)2 Control (org.omg.CosTransactions.Control)2 DemoSubTranResource (com.hp.mwtests.ts.jts.orbspecific.resources.DemoSubTranResource)1 com.hp.mwtests.ts.jts.orbspecific.resources.demosync (com.hp.mwtests.ts.jts.orbspecific.resources.demosync)1 TRANSACTION_ROLLEDBACK (org.omg.CORBA.TRANSACTION_ROLLEDBACK)1