if (logger.isDebugEnabled()) { logger.debug("Have new supply tasks... setting ReconcileSupplyExpander alarm");
if (logger.isInfoEnabled()) { logger.info("Have new supply tasks... setting ReconcileSupplyExpander alarm");
  private void updateCommStatus(Collection commStatus, Collection addedSupply) {    boolean newSupplyTasks = (!addedSupply.isEmpty());    for (Iterator iter = commStatus.iterator(); iter.hasNext();) {      CommStatus cs = (CommStatus) iter.next();      String customerName = cs.getConnectedAgentName();      CustomerState state = (CustomerState) customerStates.get(customerName);      if (state == null) {        state = new CustomerState(cs);        customerStates.put(customerName, state);      }      if (state.isCommsUp()) {        if (cs.isCommUp()) {          // state is still up          continue;        }        long latestEndTime = findLastSupplyTaskTime(customerName);        long customerLeadTime = latestEndTime - cs.getCommLossTime();        state.setCustomerLeadTime(customerLeadTime);        state.setLatestEndTime(latestEndTime);        state.setCommsUp(false);        if (logger.isDebugEnabled() && debugAgent()) {          logger.debug("Supply Type is : " + inventoryPlugin.getSupplyType() + "\n  Setting customer state for " +                       customerName + " Comm Loss time : " +                       new Date(cs.getCommLossTime()) + "\t latest end time found " +                       new Date(latestEndTime) + "\n customer lead time is " + customerLeadTime/86400000) ;        }      } else { // customer state is down        if (! cs.isCommUp()) {          // state is still down          continue;        }        if (logger.isDebugEnabled() && debugAgent()) {          logger.debug("Comms came up for  " + customerName);        }        // only set the Alarm if comms are up and we have atleast some new supply tasks        if (newSupplyTasks) {          Alarm alarm = inventoryPlugin.addAlarm(inventoryPlugin.getCurrentTimeMillis() +                                                                              COMMS_UP_DELAY);          state.setCommsUpAlarm(alarm);          if (logger.isDebugEnabled()) {            logger.debug("Have new supply tasks... setting ReconcileSupplyExpander alarm");          }        }        state.setCommsUp(true);      }    }  }