Package com.arjuna.ats.arjuna.coordinator

Examples of com.arjuna.ats.arjuna.coordinator.BasicAction


/*     */     {
/* 246 */       if (unregister)
/*     */       {
/* 248 */         while (!txs.empty())
/*     */         {
/* 250 */           BasicAction act = (BasicAction)txs.pop();
/*     */
/* 252 */           if (act != null)
/*     */           {
/* 254 */             act.removeChildThread(ThreadUtil.getThreadId(t));
/*     */           }
/*     */         }
/*     */       }
/*     */     }
/*     */   }
View Full Code Here


      throw new BAD_PARAM(
          "otid_t "
              + jtsLogger.logMesg.getString("com.arjuna.ats.internal.jts.orbspecific.otiderror"));
    else
    {
      BasicAction act = ActionManager.manager().get(u);

      if (act == null)
        throw new NoTransaction();
      else
      {
        if (act.status() == ActionStatus.RUNNING)
        {
          Object[] children = act.childTransactions();
          int size = ((children == null) ? 0 : children.length);

          if (size > 0)
          {
            ctx = new org.omg.CosTransactions.otid_t[size];
View Full Code Here

    }
  }

  public ControlImple getParentImple ()
  {
    BasicAction parent = ((_transactionHandle != null) ? _transactionHandle.parent()
        : null);

    if (parent != null)
    {
      try
      {
        synchronized (ControlImple.allControls)
        {
          return (ControlImple) ControlImple.allControls.get(parent.get_uid());
        }
      }
      catch (Exception ex)
      {
        return null;
View Full Code Here

        /*
         * Must be an Arjuna coordinator.
         */

        Uid lookingFor = new Uid(ptr.uid());
        BasicAction lookingAt = this;

        if (jtsLogger.logger.isDebugEnabled())
        {
          jtsLogger.logger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, com.arjuna.ats.jts.logging.FacilityCode.FAC_OTS, "ArjunaTransactionImple::is_descendant_transaction - looking for "
              + lookingFor);
        }

        while (lookingAt != null)
        {
          if (jtsLogger.logger.isDebugEnabled())
          {
            jtsLogger.logger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, com.arjuna.ats.jts.logging.FacilityCode.FAC_OTS, "ArjunaTransactionImple::is_descendant_transaction - looking for "
                + lookingAt.get_uid());
          }

          if (lookingAt.get_uid().equals(lookingFor))
            return true;
          else
            lookingAt = lookingAt.parent();
        }

        ptr = null;
      }
      else
View Full Code Here

      else
        throw new Inactive();
    }

    AbstractRecord corbaRec = null;
    BasicAction registerIn = this;

    if (jtsLogger.logger.isDebugEnabled())
    {
      jtsLogger.logger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, com.arjuna.ats.jts.logging.FacilityCode.FAC_OTS, "ArjunaTransactionImple "
          + get_uid() + " ::register_resource: ");
    }

    //
    // Creation of recovery coordinator (DBI)
    //

    //
    // Pack the params:
    // [0] = Transaction* this
    //

    int index = 0;
    Object params[] = new Object[10];
    params[index++] = this;

    RecoveryCoordinator recoveryCoordinator = null;
    Uid recoveryCoordinatorUid = null;

    /*
     * A RecoveryCoordinator can be null but only if the implementation
     * throws NO_IMPLEMENT. If it tries to return null then that is
     * considered an error and we will roll back the transaction.
     */

    try
    {
      recoveryCoordinator = RecoveryCreator.createRecoveryCoordinator(r, params);

      if (recoveryCoordinator == null)
        throw new BAD_OPERATION(
            "RecoveryCoordinator "
                + jtsLogger.logMesg.getString("com.arjuna.ats.internal.jts.orbspecific.coordinator.rcnotcreated"));
    }
    catch (NO_IMPLEMENT ex)
    {
      /*
       * This is legal, and is meant to show that this ORB or
       * configuration simply doesn't support crash recovery.
       */

      recoveryCoordinator = null;
    }
    catch (SystemException e)
    {
      if (jtsLogger.loggerI18N.isWarnEnabled())
      {
        jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.coordinator.rccreate", new Object[]
        { get_uid(), e });
      }

      /*
       * Set transaction to rollback only and re-throw exception.
       */

      try
      {
        rollback_only();
      }
      catch (Inactive ex1)
      {
      }
      catch (SystemException ex2)
      {
        if (jtsLogger.loggerI18N.isWarnEnabled())
        {
          jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.coordinator.rbofail", new Object[]
          { "ArjunaTransactionImple.register_resource", get_uid(), ex2 });
        }

        throw ex2;
      }

      throw e;
    }

    if (recoveryCoordinator != null)
    {
      //
      // We got a RecoveryCoordinator, so unpack the other return values:
      // [0] = RecoveryCoordinator Uid*
      //

      index = 0;
      recoveryCoordinatorUid = (Uid) params[index++];
    }
    else
    {
      //
      // We didn't get a RecoveryCoordinator, so we don't assume that
      // the other return values have been populated.
      //

      recoveryCoordinatorUid = Uid.nullUid();
    }

    try
    {
      SubtransactionAwareResource staResource = org.omg.CosTransactions.SubtransactionAwareResourceHelper.narrow(r);

      /*
       * Some Orbs (e.g., Orbix) throw BAD_PARAM is the object in X.narrow
       * is not of type X, whereas others (e.g., OrbPlus) simply return
       * NULL!
       */

      if (staResource != null)
      {
        if (jtsLogger.logger.isDebugEnabled())
        {
          jtsLogger.logger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, com.arjuna.ats.jts.logging.FacilityCode.FAC_OTS, "ArjunaTransactionImple::register_resource for "
              + get_uid()
              + " - subtransaction aware resource: YES");
        }

        /*
         * If here the narrow was ok so we have a subtran aware
         * resource.
         */

        Coordinator coord = null;

        if (parentHandle != null)
        {
          /*
           * If we are a SubTranResource then we get registered with
           * the current transaction and its parents upon completion.
           * The first parameter to the record indicates whether we
           * should be propagated (registered) with the parent
           * transaction.
           */

          coord = parentHandle.get_coordinator();
        }

        corbaRec = createOTSRecord(true, r, coord, recoveryCoordinatorUid);

        coord = null;
        staResource = null;
      }
      else
        throw new BAD_PARAM(0, CompletionStatus.COMPLETED_NO);
    }
    catch (BAD_PARAM ex)
    {
      if (jtsLogger.logger.isDebugEnabled())
      {
        jtsLogger.logger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, com.arjuna.ats.jts.logging.FacilityCode.FAC_OTS, "ArjunaTransactionImple::register_resource for "
            + get_uid() + " - subtransaction aware resource: NO");
      }

      /* narrow failed must be a plain resource */

      /*
       * Register with current transaction, but we only receive
       * invocations at top-level.
       */

      if (jtsLogger.logger.isDebugEnabled())
      {
        jtsLogger.logger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, com.arjuna.ats.jts.logging.FacilityCode.FAC_OTS, "ArjunaTransactionImple "
            + get_uid()
            + " ::register_resource: Simple resource - " + ex);
      }

      corbaRec = createOTSRecord(true, r, null, recoveryCoordinatorUid);
    }
    catch (Unavailable e1)
    {
      throw new Inactive();
    }
    catch (SystemException e2)
    {
      if (jtsLogger.logger.isDebugEnabled())
      {
        jtsLogger.logger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, com.arjuna.ats.jts.logging.FacilityCode.FAC_OTS, "ArjunaTransactionImple::register_resource for "
            + get_uid() + " : catch (SystemException) - " + e2);
      }

      throw e2;
    }
    catch (Exception e3)
    {
      if (jtsLogger.logger.isDebugEnabled())
      {
        jtsLogger.logger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, com.arjuna.ats.jts.logging.FacilityCode.FAC_OTS, "ArjunaTransactionImple::register_resource for "
            + get_uid() + " : catch (...) - " + e3);
      }

      /*
       * Cannot just rethrow exception, so throw UNKNOWN.
       */

      throw new UNKNOWN(e3.toString(), ExceptionCodes.UNKNOWN_EXCEPTION,
          CompletionStatus.COMPLETED_NO);
    }

    if (jtsLogger.logger.isDebugEnabled())
    {
      jtsLogger.logger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, com.arjuna.ats.jts.logging.FacilityCode.FAC_OTS, "ArjunaTransactionImple::register_resource for "
          + get_uid() + " : try end");
    }

    if (registerIn.add(corbaRec) != AddOutcome.AR_ADDED)
    {
      corbaRec = null;

      throw new INVALID_TRANSACTION(ExceptionCodes.ADD_FAILED,
          CompletionStatus.COMPLETED_NO);
View Full Code Here

    addControl();
  }

  public ControlImple getParentImple ()
  {
    BasicAction parent = _transactionHandle.parent();

    if (parent != null)
    {
      synchronized (ServerControl.allControls)
      {
        return (ControlImple) ServerControl.allServerControls.get(parent.get_uid());
      }
    }
    else
      return null;
  }
View Full Code Here

TOP

Related Classes of com.arjuna.ats.arjuna.coordinator.BasicAction

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.