Package com.arjuna.ats.internal.jts.orbspecific

Examples of com.arjuna.ats.internal.jts.orbspecific.CurrentImple


    }

    public synchronized boolean incr (int value)
    {
  boolean res = false;
  CurrentImple current = OTSImpleManager.current();

  try
  {
      current.begin();

      if (setlock(new Lock(LockMode.WRITE), 0) == LockResult.GRANTED)
      {
    _value = _value + value;

    current.commit(false);
    res = true;
      }
      else
    current.rollback();
  }
  catch (Exception e)
  {
      System.out.println(e);
      e.printStackTrace();
View Full Code Here


    }

    public synchronized boolean set (int value)
    {
  boolean res = false;
  CurrentImple current = OTSImpleManager.current();   

  try
  {
      current.begin();

      if (setlock(new Lock(LockMode.WRITE), 0) == LockResult.GRANTED)
      {
    _value = value;

    current.commit(false);
    res = true;
      }
      else
    current.rollback();
  }
  catch (Exception e)
  {
      System.out.println(e);
      e.printStackTrace();
View Full Code Here

    }

    public synchronized int get () throws TestException
    {
  boolean res = false;
  CurrentImple current = OTSImpleManager.current();   
  int value = -1;

  try
  {
      current.begin();

      if (setlock(new Lock(LockMode.READ), 0) == LockResult.GRANTED)
      {
    value = _value;

    current.commit(false);
    res = true;
      }
      else
    current.rollback();
  }
  catch (Exception e)
  {
      System.out.println(e);
      e.printStackTrace();
View Full Code Here

   
    manager.registerTransaction(control);

    System.out.println("setget_i.set - managed to set up interposition hierarchy");
   
    CurrentImple current = OTSImpleManager.current();
    Control cont = current.get_control();

    if (cont == null)
        System.err.println("setget_i.set error - current returned no control!");
    else
    {
        System.out.println("setget_i.set - current returned a control!");

        cont = null;
    }
   
    System.out.println("setget_i.set - beginning nested action");

    current.begin();

    cont = current.get_control();

    if (cont != null)
    {
        Coordinator coord = cont.get_coordinator();

        System.out.println("setget_i.set - registering self");
   
        coord.register_resource(ref);

        coord = null;
        cont = null;
    }
    else
        System.err.println("setget_i.set - current did not return control after begin!");
     
    value = n;
     
    System.out.println("setget_i.set - committing nested action");
 
    current.commit(true);

    manager.unregisterTransaction();

    manager = null;
      }
View Full Code Here

  _commit = doCommit;
    }

public void run ()
    {
  CurrentImple current = OTSImpleManager.current();

  try
  {
      current.begin();

      Util.indent(_threadId, 0);
      System.out.println("begin");

      AtomicWorker3.randomOperation(_threadId, 0);
      AtomicWorker3.randomOperation(_threadId, 0);

      if (_commit)
    current.commit(false);
      else
    current.rollback();

      Util.indent(_threadId, 0);

      if (_commit)
    System.out.println("end");
View Full Code Here

  return ref;
    }
    public void registerResource () throws Unavailable, Inactive, SystemException
    {
  CurrentImple current = OTSImpleManager.current();
  Control myControl = current.get_control();
  Coordinator coord = myControl.get_coordinator();

  coord.register_resource(ref);

  if (!printThread)
View Full Code Here

  return ref;
    }
    public void registerResource (boolean registerSubtran) throws Unavailable, Inactive, NotSubtransaction, SystemException
    {
  CurrentImple current = OTSImpleManager.current();
  Control myControl = current.get_control();
  Coordinator coord = myControl.get_coordinator();
   
  if (registerSubtran)
      coord.register_subtran_aware(ref);
  else
View Full Code Here

    public void run ()
    {
  boolean shouldWork = false;
 
  CurrentImple current = OTSImpleManager.current();

  if (control != null)
  {
      System.out.println("New thread resuming transaction.");

      try
      {
    current.resume(control);
      }
      catch (Exception e)
      {
    System.err.println("Caught unexpected exception: "+e);
    System.exit(1);
      }
  }
 
  try
  {
      System.out.print("Non-creating thread trying to commit transaction. ");
     
      if (control == null)
    System.out.println("Should fail - no transaction associated with thread!");
      else
    System.out.println("Should succeed.");
   
      current.commit(true);

      System.out.print("Non-creating thread committed transaction. ");

      if (control == null)
      {
View Full Code Here

    }
      }

      // Run ten interations first.

      CurrentImple current = OTSImpleManager.current();
     
      for (int i = 0; i < 10; i++)
      {
    current.begin();

    if (doCommit)
        current.commit(true);
    else
        current.rollback();
      }

      // Record the start time.

      Date startTime = new Date();

      // Run 1000 interations.
     
      for (int i = 0; i < iters; i++)
      {
    current.begin();

    if (doCommit)
        current.commit(true);
    else
        current.rollback();
      }

      // Record the end time.

      Date endTime = new Date();
View Full Code Here

        {
            System.err.println("Initialisation failed: " + e);
            assertFailure();
        }

        CurrentImple current = OTSImpleManager.current();
        Control myControl = null;
       
        System.out.println("Beginning transaction.");

        try
        {
            current.begin();

            myControl = current.get_control();

            if (myControl == null)
            {
                System.err.println("Error - control is null!");
                assertFailure();
            }
        }
        catch (Exception sysEx)
        {
            sysEx.printStackTrace(System.err);
            assertFailure();
        }

        System.out.println("Committing transaction.");

        try
        {
            current.commit(true);

            current.resume(myControl);
           
            assertSuccess();
        }
        catch (Exception e)
        {
View Full Code Here

TOP

Related Classes of com.arjuna.ats.internal.jts.orbspecific.CurrentImple

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.