log.info("handleAllocation: " + this + " got failed response due to " + reason + " for alloc " + allocI);
if(log.isInfoEnabled()) { log.info("handleAllocation: " + this + " got failed response due to " + reason + " for alloc " + allocI); }
  private final void handleAllocation(				      final Allocation allocI,				      final long currTime) {        AllocationResult responseI = allocI.getReportedResult();    if (responseI == null) {      if (log.isDebugEnabled()) {	log.error("handleAllocation: " + this + " got alloc with null AR: " + allocI);      }      // Rescind the alloc? Wait for an AR to appear?       // For now, try waiting      return;    }        // Find the single parent of the Allocation which is a Task    Task task = allocI.getTask();    if (task == null) {      // Allocation couldn't find the Task its allocating      if (log.isDebugEnabled()) {        log.error( 		"execute: " + this + 		" got Allocation with no Task parent: " + allocI);      }      rescindAllocation(allocI);      return;    }        // If the Allocation's Task doesnt point back to the Allocation, we have trouble    if (task.getPlanElement() == null || ! task.getPlanElement().equals(allocI)) {      if (log.isDebugEnabled()) {	log.error("handleAllocation: " + this + " got alloc whose Task doesn't point back to it! Alloc: " + allocI + " with RepResult: " + responseI + " and Task: " + task);      }      rescindAllocation(allocI);      return;    }    // Make sure we didnt get here by mistake    if (getAllocRuleIndex(allocI) <= -100) {      // Weve previously handled this Allocation. Don't do it again      if (log.isDebugEnabled()) {	log.error("handleAllocation: " + this + " got an Allocation and about to update the PlanElement on it, but its marked with rule index: " + getAllocRuleIndex(allocI) + " for alloc: " + allocI);      }      return;    }    // get out the deadline from the Task    long taskDeadline = getTaskDeadline(task);    // AMH 6/20: I've removed code here that checked the deadline to see if the result    // is too late. We want to favor a response over a deadline thats simulatneous,    // and if the deadline comes first, we'll rescind the Allocation anyhow.    if (responseI.getConfidenceRating() <= successBorder) {      // This response is not high confidence. For now, we do nothing      if (log.isDebugEnabled()) {	log.debug("handleAllocation: " + this + " got low confidence AR on allocation " + allocI);      }      return;    } // end of block on low-confidence AR    // OK, so the Allocation has a high confidence result.    // Was it a success?    if (responseI.isSuccess()) {      // Then we're done. Report the result up the chain.      // This copies the Reported result into the Estimated slot.      if (PlugInHelper.updatePlanElement(allocI)) {	// Mark this Allocation as having been handled, such that	// I dont try to re-handle it later.	// Do so by resetting the alloc ruleID to an obvious thing	setAllocRuleIndex(allocI, (-1 * (getAllocRuleIndex(allocI) + 100)));      	// Advertise the change	// Note that this PlugIn will see this change unless it is careful	// Also, we really out to use the new mechanism for delaying	// making the change	// The trick being that within that UnaryPredicate, we really want	// to use the PlugInHelper again, and only then do the 	// setAllocRuleIndex and log.	// FIXME!!!	publishChangeAfter(allocI, taskRespPubDelay);	//publishChange(allocI);	if (log.isDebugEnabled()) {	  log.debug("handleAllocation: " + this + " reporting succesful Allocation up: " + allocI);	}      }      return;    } // end of block on succesfull AR    // OK: It's a failure. So try to re-allocate.    int ruleIndex = 0; // fill in the AllocRuleIndex,    ruleIndex = getAllocRuleIndex(allocI);        if (log.isDebugEnabled()) {      // get the reason out of the AR      String reason = null;      // How do I retrieve the reason from the AR?      reason = responseI.auxiliaryQuery(AuxiliaryQueryType.FAILURE_REASON);      if (reason == null) 	reason = "(no reason given)";      log.info("handleAllocation: " + this + " got failed response due to " + reason + " for alloc " + allocI);    }    // However if there are no more rules, just do a failure Disposition saving the original    // failure reason    // The following method will take care of rescinding the Allocation for us    allocate(task, ruleIndex, currTime, allocI);  } // end of handleAllocation()