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

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


  {
      System.err.println("WARNING HammerObject.incr - could not do interposition");
      return false;
  }

  CurrentImple current = OTSImpleManager.current();

  try
  {
      current.begin();

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

    current.commit(true);
    res = true;
      }
      else
    current.rollback();
  }
  catch (Exception e)
  {
      System.err.println("HammerObject.get: "+e);
     
View Full Code Here


  _commit = doCommit;
    }

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

  try
  {
      current.begin();

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

      DistributedHammerWorker3.randomOperation(_threadId, 0);
      DistributedHammerWorker3.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 (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 short height () throws SystemException
    {
  System.out.println("height "+Thread.currentThread());

  CurrentImple current = OTSImpleManager.current();
  org.omg.CosTransactions.Control control = current.get_control();
  org.omg.CosTransactions.Control ptr = control;

  if (ptr != null)
  {
      System.out.println("trangrid_i.height - found implicit transactional context.");
View Full Code Here

  return m_height;
    }

    public short width () throws SystemException
    {
  CurrentImple current = OTSImpleManager.current();
  org.omg.CosTransactions.Control control = current.get_control();
  org.omg.CosTransactions.Control ptr = control;

  if (ptr != null)
  {
      System.out.println("trangrid_i.width - found implicit transactional context.");
View Full Code Here

  return m_width;
    }

    public void set (short n, short m, short value) throws SystemException
    {
  CurrentImple current = OTSImpleManager.current();
  org.omg.CosTransactions.Control control = current.get_control();

  if (control != null)
  {
      System.out.println("trangrid_i.set - found implicit transactional context!");
View Full Code Here

      myOA.initOA();

      ORBManager.setORB(myORB);
      ORBManager.setPOA(myOA);

      CurrentImple current = OTSImpleManager.current();
      AtomicResource aImpl = new AtomicResource(shouldCommit);
      Resource atomicObject = aImpl.getReference();

      System.out.println("beginning top-level transaction.");
     
      current.begin();

      Control myControl = current.get_control();

      if (myControl == null)
      {
    System.err.println("Error - myControl is nil");
    System.exit(0);
      }
     
      System.out.println("getting coordinator");
     
      coord = myControl.get_coordinator();

      myControl = null;
     
      System.out.println("registering resources.");

      RecoveryCoordinator rc = null;
     
      try
      {
    rc = coord.register_resource(atomicObject);
      }
      catch (Exception ex)
      {
    System.out.println("Failed to register resources: "+ex);
    ex.printStackTrace();
   
    System.exit(0);
      }

      if (rc == null)
    System.out.println("No recovery coordinator reference.");
      else
      {
    Status s = Status.StatusUnknown;
   
    try
    {
        System.out.println("Attempting to use recovery coordinator.");
       
        s = rc.replay_completion(atomicObject);
    }
    catch (NotPrepared e)
    {
        s = Status.StatusActive;
    }
    catch (Exception ex)
    {
        System.err.println("Caught: "+ex);
       
        ex.printStackTrace();
       
        System.exit(0);
    }

    System.out.println("Got: "+com.arjuna.ats.jts.utils.Utility.stringStatus(s));

    if (s == Status.StatusActive)
        passed = true;
      }
     
      System.out.println("committing top-level transaction.");

      if (shouldCommit)
    current.commit(true);
      else
    current.rollback();

      if (rc == null)
    System.out.println("No recovery coordinator reference.");
      else
      {
View Full Code Here

    public AtomicObject ()
    {
  super(ObjectType.ANDPERSISTENT);

  CurrentImple current = OTSImpleManager.current();

  _value = 0;

  try
  {
      current.begin();

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

    current.commit(false);
      }
      else
    current.rollback();
  }
  catch (Exception e)
  {
      System.out.println("AtomicObject "+e);
  }
View Full Code Here

      if (OTSImpleManager._current == null)
      {
        try
        {
          OTSImpleManager._current = new CurrentImple();
          OTSImpleManager._currentRef = OTSImpleManager._current;
        }
        catch (Exception e)
        {
          OTSImpleManager._current = null;
View Full Code Here

    TransactionFactoryImple _localFactory = OTSImpleManager.factory();

    try
    {
      ControlImple cont = _localFactory.recreateLocal(ctx);
      CurrentImple current = OTSImpleManager.current();

      /*
       * If this thread is associated with any transactions, then they
       * will be lost in favour of this new hierarchy, unless we have
       * remembered them explicitly.
       */

      if (_remember)
      {
        try
        {
          _oldControl = current.suspendWrapper();
        }
        catch (Exception e)
        {
          throw new InterpositionFailed();
        }
      }

      current.resumeImple(cont);

      //      current.resume(cont.getControl());

      cont = null;
    }
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.