Package com.arjuna.ats.jts.extensions

Examples of com.arjuna.ats.jts.extensions.AtomicTransaction


  public void tran_rollback_nulloper()
      throws InvocationException
  {
    try
    {
      AtomicTransaction atomicTransaction = new AtomicTransaction();

      try
      {
        atomicTransaction.begin();

        atomicTransaction.rollback();
      }
      catch (Exception exception)
      {
        System.err.println("AITImplicitObjectImpl01.tran_rollback_nulloper: " + exception);
        if (atomicTransaction.get_status() == Status.StatusActive)
        {
          atomicTransaction.rollback();
        }

        throw new InvocationException();
      }
    }
View Full Code Here


      Date start = new Date();

      for (int index = 0; index < numberOfCalls; index++)
      {
        AtomicTransaction atomicTransaction = new AtomicTransaction();

        atomicTransaction.begin();

        explicitObject.no_tran_writelock(OTS.current().get_control());

        atomicTransaction.rollback();
      }

      Date end = new Date();

      float operationDuration = ((float) (end.getTime() - start.getTime())) / ((float) numberOfCalls);
View Full Code Here

  public void tran_rollback_readlock()
      throws InvocationException
  {
    try
    {
      AtomicTransaction atomicTransaction = new AtomicTransaction();

      try
      {
        atomicTransaction.begin();

        if (setlock(new Lock(LockMode.READ), 0) == LockResult.GRANTED)
        {
          atomicTransaction.rollback();
        }
        else
        {
          atomicTransaction.rollback();

          throw new InvocationException();
        }
      }
      catch (InvocationException invocationException)
      {
        throw invocationException;
      }
      catch (Exception exception)
      {
        System.err.println("AITImplicitObjectImpl01.tran_rollback_readlock: " + exception);
        if (atomicTransaction.get_status() == Status.StatusActive)
        {
          atomicTransaction.rollback();
        }

        throw new InvocationException();
      }
    }
View Full Code Here

  public void tran_rollback_writelock()
      throws InvocationException
  {
    try
    {
      AtomicTransaction atomicTransaction = new AtomicTransaction();

      try
      {
        atomicTransaction.begin();

        if (setlock(new Lock(LockMode.WRITE), 0) == LockResult.GRANTED)
        {
          atomicTransaction.rollback();
        }
        else
        {
          atomicTransaction.rollback();

          throw new InvocationException();
        }
      }
      catch (InvocationException invocationException)
      {
        throw invocationException;
      }
      catch (Exception exception)
      {
        System.err.println("AITImplicitObjectImpl01.tran_rollback_writelock: " + exception);
        if (atomicTransaction.get_status() == Status.StatusActive)
        {
          atomicTransaction.rollback();
        }

        throw new InvocationException();
      }
    }
View Full Code Here

      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);
View Full Code Here

        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)
      {
View Full Code Here

      try
      {
        int index = 0;
        while (index < _numberOfCalls)
        {
          AtomicTransaction atomicTransaction = new AtomicTransaction();

          atomicTransaction.begin();

          try
          {
            _counter.increase(OTS.current().get_control());
            index++;
            atomicTransaction.commit(true);
          }
          catch (InvocationException invocationException)
          {
            atomicTransaction.rollback();
          }
        }
      }
      catch (Exception exception)
      {
View Full Code Here

      try
      {
        for (index = 0; index < numberOfCalls; index++)
        {
          AtomicTransaction atomicTransaction = new AtomicTransaction();

          atomicTransaction.begin();

          counter.increase(OTS.current().get_control());

          atomicTransaction.commit(true);
        }
      }
      catch (org.omg.CORBA.TRANSACTION_ROLLEDBACK e)
      {
        /*
                 * If the number of transactions created is equal to the
                 * expected result then we are not expecting this exception
                 * to be thrown therefore the test has failed
                 */
        System.err.println("Performed " + index + " calls when exception thrown");
        if (!expectingFailure)
        {
          System.err.println("Got unexpected org.omg.CORBA.TRANSACTION_ROLLEDBACK exception");
          throw e;
        }
        else
        {
          System.err.println("Got expected org.omg.CORBA.TRANSACTION_ROLLEDBACK exception");
        }

      }
      catch (Exception e)
      {
        System.err.println("Performed " + index + " calls when exception thrown");

        throw e;
      }

      AtomicTransaction atomicTransaction = new AtomicTransaction();

      atomicTransaction.begin();

      IntHolder value = new IntHolder();
      counter.get(value, OTS.current().get_control());

      try
      {
        atomicTransaction.commit(true);
      }
      catch (org.omg.CORBA.TRANSACTION_ROLLEDBACK e)
      {
        if (!expectingFailure)
        {
View Full Code Here

      Date start = new Date();

      for (int index = 0; index < numberOfCalls; index++)
      {
        AtomicTransaction atomicTransaction = new AtomicTransaction();

        atomicTransaction.begin();

        explicitObject.tran_commit_readlock(OTS.current().get_control());

        atomicTransaction.rollback();
      }

      Date end = new Date();

      float operationDuration = ((float) (end.getTime() - start.getTime())) / ((float) numberOfCalls);
View Full Code Here

    _value = 0;

    try
    {
      AtomicTransaction atomicTransaction = new AtomicTransaction();

      atomicTransaction.begin();

      if (setlock(new Lock(LockMode.WRITE), 0) == LockResult.GRANTED)
      {
        atomicTransaction.commit(true);
      }
      else
      {
        System.err.println("AITExplicitObjectImpl01.AITExplicitObjectImpl01: failed to get lock");
        atomicTransaction.rollback();

        throw new InvocationException();
      }
    }
    catch (InvocationException invocationException)
View Full Code Here

TOP

Related Classes of com.arjuna.ats.jts.extensions.AtomicTransaction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.