Alarm alarm = ((ReconcileInventoryPlugin) inventoryPlugin).addRealTimeAlarm(COMMS_UP_DELAY);
Alarm alarm = ((ReconcileInventoryPlugin) inventoryPlugin).addAlarm(inventoryPlugin.getCurrentTimeMillis() + COMMS_UP_DELAY);
  private void updateCommStatus(Collection commStatus) {    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);        }        Alarm alarm = ((ReconcileInventoryPlugin) inventoryPlugin).addRealTimeAlarm(COMMS_UP_DELAY);        state.setCommsUpAlarm(alarm);        state.setCommsUp(true);      }    }  }