Package com.arjuna.ats.txoj

Examples of com.arjuna.ats.txoj.Lock


     */
    public float balance()
    {
        float result = 0;
        // Set a read lock
        if (setlock(new Lock(LockMode.READ), 0) == LockResult.GRANTED)
        {
            result = _balance;
        }
        else
        {
View Full Code Here


     * @param value The amount to credit the account by.
     */
    public void credit(float value)
    {
        // Set a write lock
        if (setlock(new Lock(LockMode.WRITE), 0) == LockResult.GRANTED)
        {
            _balance += value;
        }
        else
        {
View Full Code Here

     * @param value The amount to debit the account by.
     */
    public void debit(float value)
    {
        // Set a write lock on the account
        if (setlock(new Lock(LockMode.WRITE), 0) == LockResult.GRANTED)
        {
            _balance -= value;
        }
        else
        {
View Full Code Here

     */
    public Account create_account(String name)
    {
        AccountImpl acc;
        AccountPOA account = null;
        if (setlock(new Lock(LockMode.WRITE), 0) == LockResult.GRANTED)
        {
            if (currentNumberOfAccounts < ACCOUNT_SIZE)
            {
                acc = new AccountImpl(name);
                account = new AccountPOATie(acc);
View Full Code Here

    {
      org.omg.CosTransactions.Current current = OTS.current();

      current.begin();

      if (setlock(new Lock(LockMode.WRITE), 0) == LockResult.GRANTED)
      {
        current.commit(true);
      }
      else
      {
View Full Code Here

      try
      {
        current.begin();

        if (setlock(new Lock(LockMode.READ), 0) == LockResult.GRANTED)
        {
          value.value = _value;
          current.commit(true);
        }
        else
View Full Code Here

      try
      {
        current.begin();

        if (setlock(new Lock(LockMode.WRITE), 0) == LockResult.GRANTED)
        {
          _value = value;
          current.commit(true);
        }
        else
View Full Code Here

      try
      {
        current.begin();

        if (setlock(new Lock(LockMode.WRITE), 0) == LockResult.GRANTED)
        {
          _value++;
          current.commit(true);
        }
        else
View Full Code Here

    {
      AtomicTransaction atomicTransaction = new AtomicTransaction();

      atomicTransaction.begin();

      if (setlock(new Lock(LockMode.WRITE), 0) == LockResult.GRANTED)
      {
        atomicTransaction.commit(true);
      }
      else
      {
View Full Code Here

        if (count != 0)
        {
          ponger.hit(count - 1, pinger, ponger, OTS.current().get_control());
          atomicTransaction.commit(true);
        }
        else if (setlock(new Lock(LockMode.WRITE), 0) == LockResult.GRANTED)
        {
          _value++;
          atomicTransaction.commit(true);
        }
        else
View Full Code Here

TOP

Related Classes of com.arjuna.ats.txoj.Lock

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.