Package com.arjuna.ats.arjuna

Examples of com.arjuna.ats.arjuna.AtomicAction


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


      expectedValue[i] = 0;
    }

    try
    {
      AtomicAction a = new AtomicAction();
      //start transaction
      a.begin();
      //add abstract record
      for (int j = 0; j < mNumberOfResources; j++)
      {
        for (int i = 0; i < mMaxIteration; i++)
        {
          expectedValue[j] += mLockRecordList[j].increase();
        }
      }
      //comit transaction
      a.commit();

      //start new AtomicAction
      AtomicAction b = new AtomicAction();
      b.begin();
      for (int j = 0; j < mNumberOfResources; j++)
      {
        for (int i = 0; i < mMaxIteration; i++)
        {
          mLockRecordList[j].increase();
        }
      }
      //abort transaction
      b.abort();
    }
    catch (Exception e)
    {
      mCorrect = false;
      qautil.debug("exception in worker001: ", e);
View Full Code Here

    Xid[] xids = new Xid[2];

    if (ExampleXAResource.toRecover == null)
    {
      AtomicAction a = new AtomicAction();

      ExampleXAResource.toRecover = new XidImple(new AtomicAction());
    }

    xids[0] = ExampleXAResource.toRecover;
    xids[1] = new XidImple(new AtomicAction());

    return xids;
  }
View Full Code Here

  {
    if (xids == null)
    {
      xids = new Xid[2];

      AtomicAction a = new AtomicAction();

      xids[0] = new XidImple(a);

      byte[] c = com.arjuna.ats.arjuna.coordinator.TxControl.getXANodeName();
View Full Code Here

  }

  public void startTx()
      throws Exception
  {
    mAtom = new AtomicAction();
    mAtom.begin();
  }
View Full Code Here

  }

  public void createTx()
      throws Exception
  {
    mAtom = new AtomicAction();
  }
View Full Code Here

  }

  public void createTx(Uid uid)
      throws Exception
  {
    mAtom = new AtomicAction(uid);
  }
View Full Code Here

      expectedValue[j] = 0;
    }

    try
    {
      AtomicAction a = new AtomicAction();
      //start transaction
      a.begin();
      //add abstract record
      for (int j = 0; j < mNumberOfResources; j++)
      {
        for (int i = 0; i < mMaxIteration; i++)
        {
          expectedValue[j] += mLockRecordList[j].increase();
        }
      }
      //comit transaction
      a.commit();

      //start new AtomicAction
      AtomicAction b = new AtomicAction();
      b.begin();
      for (int j = 0; j < mNumberOfResources; j++)
      {
        for (int i = 0; i < mMaxIteration; i++)
        {
          mLockRecordList[j].increase();
        }
      }
      //abort transaction
      b.abort();
    }
    catch (Exception e)
    {
      mCorrect = false;
      qautil.debug("exception in worker001: ", e);
View Full Code Here

      for (int j = 0; j < mNumberOfResources; j++)
      {
        for (int i = 0; i < mMaxIteration; i++)
        {
          //start transaction
          AtomicAction a = new AtomicAction();
          a.begin();
          int incValue = mLockRecordList[j].increase();
          if (i % 2 == 0)
          {
            a.commit();
            expectedValue[j] += incValue;
          }
          else
          {
            a.abort();
          }
        }
      }

      for (int j = 0; j < mNumberOfResources; j++)
      {
        for (int i = 0; i < mMaxIteration; i++)
        {
          AtomicAction b = new AtomicAction();
          b.begin();
          int incValue = mLockRecordList[j].increase();
          if (i % 2 == 0)
          {
            b.commit();
            expectedValue[j] += incValue;
          }
          else
          {
            b.abort();
          }
        }
      }
    }
    catch (Exception e)
View Full Code Here

   */
  public void run()
  {
    try
    {
      AtomicAction a = new AtomicAction();
      //start transaction
      a.begin();
      mService.setupOper(true);
      mService.doWork(mMaxIteration);
      a.commit();

      mService = new Service01(mNumberOfResources);
      //start new AtomicAction
      AtomicAction b = new AtomicAction();
      b.begin();
      mService.setupOper(true);
      mService.doWork(mMaxIteration);
      b.abort();
    }
    catch (Exception e)
    {
      mCorrect = false;
      qautil.debug("exception in worker002: ", e);
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.