if (logger.isInfoEnabled()) logger.info("Success in processing: " + cbe.dumpAvailableVariants()); publishRemove(cbe); }
cbe.actionCompleted(); if (cbe.noOutstandingSelectionsP()) { if (logger.isInfoEnabled()) logger.info("Done processing: " + cbe.dumpAvailableVariants()); publishRemove(cbe); } }
  public void execute() {        Iterator iter;              // leash the defenses on rehydration if leashOnRestart is TRUE, otherwise leave as-is - dlw - 9/7/04        if (blackboard.didRehydrate() && leashOnRestart) {            iter = knobSubscription.iterator();                if (iter.hasNext()) {                ActionSelectionKnob knob = (ActionSelectionKnob) iter.next();                knob.leash();                blackboard.publishChange(knob);                if (logger.isDebugEnabled())                     logger.debug("rehydrate detected  && leashOnRestart==true - enabling ThrashingSuppression");                   }        }              // Get the ActionSelectionKnob for current settings        iter = knobSubscription.iterator();        if (iter.hasNext())         {                    knob = (ActionSelectionKnob) iter.next();        }      // Use the Control Knob to determine if Defenses are Leashed & if so, do nothing more        if (knob.isEnclaveLeashed()) {            if (logger.isInfoEnabled()) logger.info("Enclave Defenses are LEASHED - no actions will be selected");            return;        }      //********* Process Actions that have Responded ***********      if (logger.isDetailEnabled()) logger.detail("Ready to Process Action Responses");      iter = actionPatienceSubscription.getChangedCollection().iterator();      // Mark the resolution of all the Actions that just reported back (for now it will just be one Action)      while (iter.hasNext()) {          ActionPatience ap = (ActionPatience)iter.next();          publishRemove(ap);    // we have the info we want, so get rid of it           removeActionPatience(ap);          Action action = ap.getAction();          if (logger.isDebugEnabled()) logger.debug("Removed this AP: " + ap.toString());          // get the CBE associated with the Action          CostBenefitEvaluation cbe = ap.getCBE();   ///findCostBenefitEvaluation(action.getAssetID());          ActionEvaluation ae = cbe.getActionEvaluation(action);          if (logger.isDebugEnabled()) logger.debug(action.dump() + " has " + ap.getResult());          if (action.getValue() == null) {              Iterator iter2 = action.getPermittedValues().iterator();              while (iter2.hasNext()) {                  Object variantNotTried = iter2.next();                  if (logger.isInfoEnabled()) logger.info("For: " + action.getAssetID().toString() + ", " + variantNotTried.toString() + " timed out w/o being tried - Try something else.  Timed out action no longer permitted w/o re-authorization.");                  VariantEvaluation ve = ae.getVariantEvaluation(variantNotTried);                  ve.setFailed();              }              selectActions(cbe, knob);  // try to find a new action          }          else {              Object variantAttempted = action.getValue().getAction();              VariantEvaluation ve = ae.getVariantEvaluation(variantAttempted);              if (ap.getResult().equals(Action.FAILED)) {                  if (logger.isInfoEnabled()) logger.info("For: " + action.getAssetID().toString() + ", " + variantAttempted.toString() + " failed - Try something else.  Failed action no longer permitted w/o re-authorization.");                  ve.setFailed();                  selectActions(cbe, knob);  // try to find a new action                  publishAdd(new RetractedActions(action, cbe));              }              else if (ap.getResult().equals(Action.COMPLETED)) {                  if (logger.isInfoEnabled()) logger.info("For: " + action.getAssetID().toString() + ", " + variantAttempted.toString() + " succeeded - Nothing more to do.  Completed action no longer permitted w/o re-authorization.");                  publishAdd(new RetractedActions(action, cbe));                  if (logger.isInfoEnabled()) logger.info("Sucess in processing: " + cbe.dumpAvailableVariants());                  publishRemove(cbe);              }              else if (ap.getResult().equals(Action.ACTIVE)) {                  if (logger.isInfoEnabled()) logger.info("For: " + action.getAssetID().toString() + ", " + variantAttempted.toString() + " is active - Other actions may be pending.");                  //publishAdd(new RetractedActions(action));                  if (logger.isInfoEnabled()) logger.info("Success in processing: " + cbe.dumpAvailableVariants());                  publishRemove(cbe);              }              else logger.error("Unhandled Action result: " + ap.getResult().toString());          }      }      if (logger.isDetailEnabled()) logger.detail("Done processing Action Responses");            //********* Process new CostBenefit objects ************          iter = costBenefitSubscription.getAddedCollection().iterator();      while (iter.hasNext()) {          CostBenefitEvaluation cbe = (CostBenefitEvaluation)iter.next();           if (logger.isDebugEnabled()) logger.debug("Saw new CBD: \n"+cbe.toString());          selectActions(cbe, knob);      }  }