Package com.arjuna.ats.arjuna.common

Examples of com.arjuna.ats.arjuna.common.Uid


    {

        TransactionReaper reaper = TransactionReaper.transactionReaper();


        Reapable reapable = new MockReapable(new Uid());
        Reapable reapable2 = new MockReapable(new Uid());
        Reapable reapable3 = new MockReapable(new Uid());

        ReaperElement reaperElement = new ReaperElement(reapable, 30);
        ReaperElement reaperElement2 = new ReaperElement(reapable2, 20);
        ReaperElement reaperElement3 = new ReaperElement(reapable3, 10);
View Full Code Here


      OutputObjectState dummyState = new OutputObjectState();
     
      try
      {
        dummyState.packInt(fakeData);     
        ids[i] = new Uid();
        objStore.write_committed(ids[i], type, dummyState);
      }
      catch (final Exception ex)
      {
        ex.printStackTrace();
      }
    }
   
    InputObjectState ios = new InputObjectState();
    boolean passed = false;
   
    try
    {
      if (objStore.allObjUids(type, ios, ObjectStore.OS_UNKNOWN))
      {
        Uid id = new Uid(Uid.nullUid());
        int numberOfEntries = 0;
       
        do
        {
          try
          {
            id.unpack(ios);
          }
          catch (Exception ex)
          {
            id = Uid.nullUid();
          }

          if (id.notEquals(Uid.nullUid()))
          {
            passed = true;
           
            System.err.println("Located transaction log "+id+" in object store.");
           
            numberOfEntries++;
           
            boolean found = false;
           
            for (int i = 0; i < ids.length; i++)
            {
              if (id.equals(ids[i]))
                found = true;
            }
           
            if (passed && !found)
            {
              passed = false;

              System.err.println("Found unexpected transaction!");
            }
          }
        }
        while (id.notEquals(Uid.nullUid()));
       
        if ((numberOfEntries != ids.length) && passed)
        {
          passed = false;
         
View Full Code Here

    System.setProperty(Environment.OBJECTSTORE_TYPE, ArjunaNames.Implementation_ObjectStore_ActionLogStore().stringForm());
    System.setProperty(Environment.TRANSACTION_LOG_SYNC_REMOVAL, "true");
    System.setProperty(Environment.TRANSACTION_LOG_PURGE_TIME, "1000000")// essentially infinite
   
    AtomicAction A = new AtomicAction();
    Uid txId = A.get_uid();
   
    System.err.println("IMPORTANT: if there are warnings about USER_DEF_FIRST0 then the test has failed!");
   
    A.begin();
View Full Code Here

      OutputObjectState dummyState = new OutputObjectState();
     
      try
      {
        dummyState.packInt(fakeData);     
        ids[i] = new Uid();
        objStore.write_committed(ids[i], type, dummyState);
      }
      catch (final Exception ex)
      {
        ex.printStackTrace();
      }
    }
   
    try
    {
      objStore.remove_committed(ids[0], type);
    }
    catch (final Exception ex)
    {
      ex.printStackTrace();
    }
   
    try
    {
      /*
       * Give the purger thread a chance to run and delete
       * the entry.
       */
     
      Thread.sleep(12000);
    }
    catch (final Exception ex)
    {
    }
   
    InputObjectState ios = new InputObjectState();
    boolean passed = false;
   
    try
    {
      if (objStore.allObjUids(type, ios, ObjectStore.OS_UNKNOWN))
      {
        Uid id = new Uid(Uid.nullUid());
        int numberOfEntries = 0;
       
        do
        {
          try
          {
            id.unpack(ios);
          }
          catch (Exception ex)
          {
            id = Uid.nullUid();
          }

          if (id.notEquals(Uid.nullUid()))
          {
            passed = true;
           
            numberOfEntries++;
           
            boolean found = false;
           
            for (int i = 0; i < ids.length; i++)
            {
              if (id.equals(ids[i]))
                found = true;
            }
           
            if (passed && !found)
            {
              passed = false;

              System.err.println("Found unexpected transaction!");
            }
          }
        }
        while (id.notEquals(Uid.nullUid()));
       
        if ((numberOfEntries == ids.length -1) && passed)
        {
          if (objStore.currentState(ids[0], type) != ObjectStore.OS_UNKNOWN)
            passed = false;
View Full Code Here

public class CrashAbstractRecordImpl extends AbstractRecord
{  
   public CrashAbstractRecordImpl( int crashBehaviour )
   {
      super( new Uid( "-7FFFFFF"+ _count + ":0:0:0" ),
              "com.hp.mwtests.ts.arjuna.recovery.CrashAbstractRecordImpl",
                      ObjectType.ANDPERSISTENT);
      _count++ ;
      _crash_behaviour = crashBehaviour ;
   }
View Full Code Here

         XAResource res1 = sess1.getXAResource();
  
         XAResource res2 = sess2.getXAResource();
  
         //Pretend to be a transaction manager by interacting through the XAResources
         Xid xid1 = new XidImple(new Uid("cadaver"), new Uid("bq1"), 666);
         Xid xid2 = new XidImple(new Uid("dalidom"), new Uid("bq2"), 661);   // TODO
  
  
         //    Send a message in each tx
  
         res1.start(xid1, XAResource.TMNOFLAGS);
View Full Code Here

  }

  public static Uid loadUid(String objectName)
      throws Exception
  {
    Uid objectUid = new Uid(ServerIORStore.loadIOR(objectName));

    return objectUid;
  }
View Full Code Here

  try
  {
      if (objStore.allObjUids(type, ios, ObjectStore.OS_UNKNOWN))
      {
    Uid id = new Uid(Uid.nullUid());

    do
    {
        try
        {
      id.unpack(ios);
        }
        catch (Exception ex)
        {
      id = Uid.nullUid();
        }

        if (id.notEquals(Uid.nullUid()))
      System.err.println("Got UNKNOWN "+id);

        passed = true;

    } while (id.notEquals(Uid.nullUid()));
      }

      System.err.println("\n");

      if (objStore.allObjUids(type, ios, ObjectStore.OS_COMMITTED))
      {
    Uid id = new Uid(Uid.nullUid());

    do
    {
        try
        {
      id.unpack(ios);
        }
        catch (Exception ex)
        {
      id = Uid.nullUid();
        }

        if (id.notEquals(Uid.nullUid()))
      System.err.println("Got COMMITTED "+id);

        passed = true;

    } while (id.notEquals(Uid.nullUid()));
      }

      System.err.println("\n");

      if (objStore.allObjUids(type, ios, ObjectStore.OS_UNCOMMITTED))
      {
    Uid id = new Uid(Uid.nullUid());

    do
    {
        try
        {
      id.unpack(ios);
        }
        catch (Exception ex)
        {
      id = Uid.nullUid();
        }

        if (id.notEquals(Uid.nullUid()))
      System.err.println("Got UNCOMMITTED "+id);

        passed = true;

    } while (id.notEquals(Uid.nullUid()));
      }
  }
  catch (Exception ex)
  {
      ex.printStackTrace();
View Full Code Here

        // to cancel requests and ensure that they get cancelled
        // and that the reaper does not get wedged

        // the rendezvous for the reapables are keyed by the reapable's uid

        Uid uid0 = new Uid();
        Uid uid1 = new Uid();
        Uid uid2 = new Uid();
        Uid uid3 = new Uid();

        // reapable0 will return CANCELLED from cancel and will rendezvous inside the cancel call
        // so we can delay it. prevent_commit should not get called so we don't care about the arguments
        TestReapable reapable0 = new TestReapable(uid0, true, true, false, false);
        // reapable1 will return CANCELLED from cancel and will not rendezvous inside the cancel call
View Full Code Here

      OutputObjectState dummyState = new OutputObjectState();
     
      try
      {
        dummyState.packInt(fakeData);     
        ids[i] = new Uid();
        objStore.write_committed(ids[i], type, dummyState);
      }
      catch (final Exception ex)
      {
        ex.printStackTrace();
      }
    }
   
    /*
     * Remove 50% of the entries, simulating a crash during
     * normal execution.
     *
     * Q: why not just write 50% in the first place?
     * A: because we will extend this test to allow the recovery
     *    system to run in between writing and removing.
     */
   
    for (int i = 0; i < numberOfTransactions / 2; i++)
    {
      try
      {
        objStore.remove_committed(ids[i], type);
      }
      catch (final Exception ex)
      {
        ex.printStackTrace();
      }
    }
   
    try
    {
      /*
       * Give the purger thread a chance to run and delete
       * the entries we've "removed" (really only marked as
       * being removable.)
       */
     
      Thread.sleep(12000);
    }
    catch (final Exception ex)
    {
    }
   
    /*
     * Now get a list of entries to work on.
     */
   
    InputObjectState ios = new InputObjectState();
    boolean passed = true;
   
    try
    {
      if (objStore.allObjUids(type, ios, ObjectStore.OS_UNKNOWN))
      {
        Uid id = new Uid(Uid.nullUid());
        int numberOfEntries = 0;
       
        do
        {
          try
          {
            id.unpack(ios);
          }
          catch (Exception ex)
          {
            id = Uid.nullUid();
          }

          if (id.notEquals(Uid.nullUid()))
          {
            numberOfEntries++;
           
            boolean found = false;
           
            for (int i = 0; i < ids.length; i++)
            {
              if (id.equals(ids[i]))
                found = true;
            }
           
            if (passed && !found)
            {
              passed = false;

              System.err.println("Found unexpected transaction!");
            }
          }
        }
        while (id.notEquals(Uid.nullUid()));
       
        if ((numberOfEntries == numberOfTransactions / 2) && passed)
        {
          System.err.println("Would attempt recovery on "+numberOfEntries+" dead transactions.");
        }
View Full Code Here

TOP

Related Classes of com.arjuna.ats.arjuna.common.Uid

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.