synchronized (restartsInProcess) { for (Iterator it = restartsInProcess.entrySet().iterator(); it.hasNext(); ) { Map.Entry me = (Map.Entry)it.next(); MessageAddress agent = (MessageAddress)me.getKey(); long expiration = ((Long)me.getValue()).longValue(); if (expiration < now) { it.remove(); logger.debug("Restart timeout: agent=" + agent); restartComplete(agent, agentId, FAIL); }
MessageAddress currentRestarts[] = getRestartsInProcess(); for (int i = 0; i < currentRestarts.length; i++) { long expiration = ((Long)restartsInProcess.get(currentRestarts[i])). longValue(); if (expiration < now) { restartComplete(currentRestarts[i], agentId, FAIL);
  private void removeExpiredRestarts() {    long now = now();    synchronized (restartsInProcess) {      for (Iterator it = restartsInProcess.entrySet().iterator(); it.hasNext(); ) {        Map.Entry me = (Map.Entry)it.next();        MessageAddress agent = (MessageAddress)me.getKey();        long expiration = ((Long)me.getValue()).longValue();        if (expiration < now) {          it.remove();          logger.debug("Restart timeout: agent=" + agent);          restartComplete(agent, agentId, FAIL);        }      }    }  }