Package com.arjuna.ats.arjuna

Examples of com.arjuna.ats.arjuna.AtomicAction


private void test () throws Exception
    {
  for (int i = 0; i < 100; i++)
  {
      AtomicAction A = new AtomicAction();
 
      A.begin();

      BasicObject bo = new BasicObject();

      bo.set(2);
 
      A.commit();

      AtomicAction B = new AtomicAction();
 
      B.begin();
 
      bo.destroy();
 
      B.abort();
 
      AtomicAction C = new AtomicAction();
     
      C.begin();
     
      bo.destroy();
     
      C.commit();
  }
    }
View Full Code Here


            _tests_passed = 0;
            _tests_failed = 0;

            _test_service = new ActionStatusService();

            _transaction_1 = new AtomicAction();
            _transaction_2 = new AtomicAction();
            _transaction_3 = new AtomicAction();

            _test_tran_type_1 = _transaction_1.type();
            _test_tran_type_2 = _transaction_2.type();
            _test_tran_type_3 = _transaction_3.type();
View Full Code Here

         _tests_failed = 0 ;

         // needed to force TxControl static initialization
         ObjectStore os = TxControl.getStore() ;

         _transaction_1 = new AtomicAction() ;
         _transaction_2 = new AtomicAction() ;
         _transaction_3 = new AtomicAction() ;

         _test_tran_type_1 = _transaction_1.type() ;
         _test_tran_type_2 = _transaction_2.type() ;
         _test_tran_type_3 = _transaction_3.type() ;
View Full Code Here

public class DestroyRecoverTest
{

    public static void main (String[] args)
    {
  AtomicAction A = new AtomicAction();
  BasicObject bo = null;
  Uid txId = null;
  Uid objId = null;
  boolean passed = true;

  com.arjuna.ats.arjuna.common.Configuration.setAlternativeOrdering(true);
 
  try
  {
      A.begin();

      bo = new BasicObject();
      objId = bo.get_uid();

      A.removeThread();
     
      A.commit();
  }
  catch (Exception ex)
  {
      ex.printStackTrace();
     
      passed = false;
  }     

  if (passed)
  {
      try
      {
    A = new AtomicAction();
   
    txId = A.get_uid();
   
    A.begin();

    bo.activate();
     
    bo.destroy();
 
    A.add(new BasicCrashRecord());

    A.removeThread();
   
    A.commit();
      }
      catch (com.arjuna.ats.arjuna.exceptions.FatalError ex)
      {
    // ignore
      }
View Full Code Here

public void run(String[] args)
    {
        try
        {
            AtomicAction A = new AtomicAction();
            AtomicAction B = new AtomicAction();

            logInformation("Starting top-level action.");

            A.begin();

            logInformation(A.toString());

            logInformation("Starting nested action.");

            B.begin();

            logInformation(B.toString());

            logInformation("Committing top-level action. This should fail.");

            A.commit();

            logInformation("Committing nested action. This should fail.");

            B.commit();

            BasicAction current = BasicAction.Current();

            logInformation("Current action is " + current);
View Full Code Here

    public void run (String[] args)
    {
        try
        {
      boolean success = false;
            AtomicAction A = new AtomicAction();
      OnePhase opRes = new OnePhase();
     
      System.err.println("Starting top-level action.");

            A.begin();

      A.add(new LastResourceRecord(opRes));
      A.add(new ShutdownRecord(ShutdownRecord.FAIL_IN_PREPARE));
     
      A.commit();

      if (opRes.status() != OnePhase.COMMITTED)
      {
    System.err.println("Confirmed that one-phase record is last in prepare.");

    A = new AtomicAction();
    opRes = new OnePhase();

    A.begin();
   
    System.err.println("\nStarting new top-level action.");

    A.add(new LastResourceRecord(opRes));
    A.add(new ShutdownRecord(ShutdownRecord.FAIL_IN_COMMIT));

    A.commit();
   
    if (opRes.status() == OnePhase.COMMITTED)
    {
        System.err.println("Confirmed that one-phase record is first in commit.");

        A = new AtomicAction();
       
        A.begin();
       
        A.add(new LastResourceRecord(new OnePhase()));
       
        if (A.add(new LastResourceRecord(new OnePhase())) == AddOutcome.AR_DUPLICATE)
        {
      System.err.println("\nConfirmed that only one such resource can be added.");
     
      assertSuccess();
        }
View Full Code Here

  System.runFinalization();
    }

private void test () throws Exception
    {
  AtomicAction A = new AtomicAction();

  A.begin();

  A = null;

  System.gc();
    }
View Full Code Here

  int numberOfTransactions = 1000;
  long stime = Calendar.getInstance().getTime().getTime();

  for (int i = 0; i < numberOfTransactions; i++)
  {
      AtomicAction A = new AtomicAction();

      A.begin();
      A.abort();
  }

  long ftime = Calendar.getInstance().getTime().getTime();
  long timeTaken = ftime - stime;
View Full Code Here

    {
  for (int i = 0; i < _iters; i++)
  {
      try
      {
    AtomicAction A = new AtomicAction();
   
    A.begin();
   
    A.add(new BasicRecord());

    A.commit();
      }
      catch (Exception e)
      {
    e.printStackTrace();
      }
View Full Code Here

TOP

Related Classes of com.arjuna.ats.arjuna.AtomicAction

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.