container/common/src/main/java/org/mobicents/slee/container/deployment/jboss/DeploymentManager.java
private void sciAction(Collection<ManagementAction> actions, DeployableUnit du)
  throws Exception {
   
    // For each action, get the params..
    for (ManagementAction action : actions) {
     
      // Shall we skip this action?
      if (actionsToAvoidByDU.get(du) != null && actionsToAvoidByDU.get(du).remove(action)) {
        // Clean if it was the last one.
        if (actionsToAvoidByDU.get(du).size() == 0) {
          actionsToAvoidByDU.remove(du);
        }
        continue;
      }

      if (logger.isTraceEnabled()) {
        logger.trace("Invoking " + action);
      }

      // We are isolating each action, so it won't affect the whole proccess
      try {
        // Invoke it.
        action.invoke();
        // We need to wait for service/entity to deactivate...
        /*if(action instanceof DeactivateServiceAction) {
          waitForServiceDeactivation((DeactivateServiceAction) action);
        }
        else if (action instanceof DeactivateResourceAdaptorEntityAction) {
          waitForResourceAdaptorEntityDeactivation((DeactivateResourceAdaptorEntityAction) action);
        }*/
      }
      catch (Exception e) {
        // We might expect some exceptions...
        if (e.getCause() instanceof ResourceAdaptorEntityAlreadyExistsException || (e.getCause() instanceof InvalidStateException 
            && action instanceof ActivateResourceAdaptorEntityAction)) {
          Class<? extends ManagementAction> actionToAvoid = null;

          // If the activate/create failed then we don't want to deactivate/remove
          if (action instanceof ActivateResourceAdaptorEntityAction) {
            actionToAvoid = DeactivateResourceAdaptorEntityAction.class;
          }
          else if (action instanceof CreateResourceAdaptorEntityAction) {
            actionToAvoid = RemoveResourceAdaptorEntityAction.class;
          }

          Collection<Class<? extends ManagementAction>> actionsToAvoid;
          if ((actionsToAvoid = actionsToAvoidByDU.get(du)) == null) {
            actionsToAvoid = new ArrayList<Class<? extends ManagementAction>>();

            // Add it to the list of actions to skip on undeploy
            actionsToAvoid.add(actionToAvoid);

            // And put it to the map
            actionsToAvoidByDU.put(du, actionsToAvoid);
          }
          else {
            // Add it to the list of actions to skip on undeploy
            actionsToAvoid.add(actionToAvoid);
          }

          logger.warn(e.getCause().getMessage());
        }
        else if (e.getCause() instanceof InvalidStateException && action instanceof DeactivateServiceAction) {
          logger.info("Delaying uninstall due to service deactivation not complete.");
        }
        else if (e.getCause() instanceof InvalidStateException && action instanceof DeactivateResourceAdaptorEntityAction) {
          // ignore this... someone has already deactivated the link.
        }
        else if (e.getCause() instanceof UnrecognizedLinkNameException && action instanceof UnbindLinkNameAction) {
          // ignore this... someone has already removed the link.
        }
        else if (action.getType() == ManagementAction.Type.DEPLOY_MANAGEMENT) {
          logger.error("Failure invoking '" + action, e);
        }
        else {
          throw e;
        }
      }

      // Wait a little while just to make sure it finishes
      Thread.sleep(waitTimeBetweenOperations);
    }
  }
private void sciAction(Collection<ManagementAction> actions, DeployableUnit du)
  throws Exception {
   
    // For each action, get the params..
    for (ManagementAction action : actions) {
     
      // Shall we skip this action?
      if (actionsToAvoidByDU.get(du) != null && actionsToAvoidByDU.get(du).remove(action)) {
        // Clean if it was the last one.
        if (actionsToAvoidByDU.get(du).size() == 0) {
          actionsToAvoidByDU.remove(du);
        }
        continue;
      }

      if (logger.isTraceEnabled()) {
        logger.trace("Invoking " + action);
      }

      // We are isolating each action, so it won't affect the whole proccess
      try {
        // Invoke it.
        action.invoke();
        // We need to wait for service/entity to deactivate...
        /*if(action instanceof DeactivateServiceAction) {
          waitForServiceDeactivation((DeactivateServiceAction) action);
        }
        else if (action instanceof DeactivateResourceAdaptorEntityAction) {
          waitForResourceAdaptorEntityDeactivation((DeactivateResourceAdaptorEntityAction) action);
        }*/
      }
      catch (Exception e) {
        // We might expect some exceptions...
        if (e.getCause() instanceof ResourceAdaptorEntityAlreadyExistsException || (e.getCause() instanceof InvalidStateException 
            && action instanceof ActivateResourceAdaptorEntityAction)) {
          Class<? extends ManagementAction> actionToAvoid = null;

          // If the activate/create failed then we don't want to deactivate/remove
          if (action instanceof ActivateResourceAdaptorEntityAction) {
            actionToAvoid = DeactivateResourceAdaptorEntityAction.class;
          }
          else if (action instanceof CreateResourceAdaptorEntityAction) {
            actionToAvoid = RemoveResourceAdaptorEntityAction.class;
          }

          Collection<Class<? extends ManagementAction>> actionsToAvoid;
          if ((actionsToAvoid = actionsToAvoidByDU.get(du)) == null) {
            actionsToAvoid = new ArrayList<Class<? extends ManagementAction>>();

            // Add it to the list of actions to skip on undeploy
            actionsToAvoid.add(actionToAvoid);

            // And put it to the map
            actionsToAvoidByDU.put(du, actionsToAvoid);
          }
          else {
            // Add it to the list of actions to skip on undeploy
            actionsToAvoid.add(actionToAvoid);
          }

          logger.warn(e.getCause().getMessage());
        }
        else if (e.getCause() instanceof InvalidStateException && action instanceof DeactivateServiceAction) {
          logger.info("Delaying uninstall due to service deactivation not complete.");
        }
        else if (e.getCause() instanceof InvalidStateException && action instanceof DeactivateResourceAdaptorEntityAction) {
          // ignore this... someone has already deactivated the link.
        }
        else if (e.getCause() instanceof UnrecognizedLinkNameException && action instanceof UnbindLinkNameAction) {
          // ignore this... someone has already removed the link.
        }
        else if (action.getType() == ManagementAction.Type.DEPLOY_MANAGEMENT) {
          logger.error("Failure invoking '" + action, e);
        }
        else {
          throw e;
        }
      }

      // Wait a little while just to make sure it finishes
      Thread.sleep(waitTimeBetweenOperations);
    }
  }
Method for performing the actions needed for (un)deployment.
@param actions the array of strings containing the actions to perform.
@param du the DeployableUnit from where the actions are being performed.
@throws Exception