Package com.arjuna.ats.jts

Examples of com.arjuna.ats.jts.ExplicitInterposition


    if (tpc instanceof PropagationContextWrapper)
    {
      try
      {
        PropagationContext omgTpc = ((PropagationContextWrapper) tpc).getPropagationContext();
        ExplicitInterposition ei = new ExplicitInterposition(omgTpc, true);
        Transaction newTx = tm.getTransaction();

        if (log.isDebugEnabled())
        {
          log.debug("PropagationContextManager.importTransactionPropagationContext(Object) - transaction = " + newTx);
        }


        ei.unregisterTransaction();

        return newTx;
      }
      catch (Exception e)
      {
View Full Code Here


    }

    public boolean incr (int value, Control control) throws SystemException
    {
  boolean res = false;
  ExplicitInterposition inter = new ExplicitInterposition();

  try
  {
      inter.registerTransaction(control);
  }
  catch (Exception e)
  {
      System.err.println("WARNING HammerObject.incr - could not do interposition");
      return false;
  }

  CurrentImple current = OTSImpleManager.current();

  try
  {
      current.begin();

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

    current.commit(true);
    res = true;
      }
      else
    current.rollback();
  }
  catch (Exception e)
  {
      System.err.println("HammerObject.incr: "+e);
     
      res = false;
  }

  inter.unregisterTransaction();
 
  return res;
    }
View Full Code Here

    }

    public boolean set (int value, Control control) throws SystemException
    {
  boolean res = false;
  ExplicitInterposition inter = new ExplicitInterposition();

  try
  {
      inter.registerTransaction(control);
  }
  catch (Exception e)
  {
      System.err.println("WARNING HammerObject.set - could not do interposition");
      return false;
  }

  CurrentImple current = OTSImpleManager.current();   

  try
  {
      current.begin();

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

    current.commit(true);
    res = true;
      }
      else
    current.rollback();
  }
  catch (Exception e)
  {
      System.err.println("HammerObject.set: "+e);

      res = false;
  }

  inter.unregisterTransaction();

  return res;
    }
View Full Code Here

    }

    public boolean get (IntHolder value, Control control) throws SystemException
    {
  boolean res = false;
  ExplicitInterposition inter = new ExplicitInterposition();

  try
  {
      inter.registerTransaction(control);
  }
  catch (Exception e)
  {
      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);
     
      res = false;
  }

  inter.unregisterTransaction();
 
  return res;
    }
View Full Code Here

TOP

Related Classes of com.arjuna.ats.jts.ExplicitInterposition

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.