public void layoutReady(Map layout) { controller.getLoadBalancer().moveAgents(layout);
public void layoutReady(Map layout) {  RestartDestinationLocator locator = controller.getRestartLocator(); MoveHelper mover = controller.getMoveHelper(); locator.setPreferredRestartLocations(layout); for (Iterator it = nodesToVacate.iterator(); it.hasNext();) { String origin = (String)it.next(); Set agentsOnNode = affectedAgents(Collections.singleton(origin)); for (Iterator it1 = agentsOnNode.iterator(); it1.hasNext();) { String agent = (String)it1.next(); String dest = locator.getRestartLocation(agent, excludedNodes); if (logger.isInfoEnabled()) { logger.info("Moving agent:" + " agent=" + agent + " origin=" + origin + " dest=" + dest); } mover.moveAgent(agent, origin, dest, communityName); } }
  private void vacate(final Set nodesToVacate) {    final Set agentsToMove = affectedAgents(nodesToVacate);    if (logger.isInfoEnabled()) {      logger.info("Vacating nodes: " + nodesToVacate);    }    model.addChangeListener(new StatusChangeListener() {      public void statusChanged(CommunityStatusChangeEvent[] csce) {        for (int i = 0; i < csce.length; i++) {          if (csce[i].locationChanged() &&              agentsToMove.contains(csce[i].getName()) &&              !nodesToVacate.contains(csce[i].getCurrentLocation())) {            agentsToMove.remove(csce[i].getName());            if (agentsToMove.isEmpty()) {              if (logger.isInfoEnabled()) {                logger.info("Vacate nodes complete: nodes=" + nodesToVacate);              }              model.removeChangeListener(this);            }          }        }      }    });    LoadBalancerListener lbl = new LoadBalancerListener() {      public void layoutReady(Map layout) {        controller.getLoadBalancer().moveAgents(layout);      }    };    controller.getLoadBalancer().doLayout(RestartManagerConstants.DEFAULT_LOAD_BALANCER_MODE,                                          RestartManagerConstants.ANNEAL_TIME,                                          LoadBalancer.DEFAULT_HAMMING,                                          Collections.EMPTY_LIST,                                          new ArrayList(nodesToVacate),                                          new ArrayList(getExcludedNodes()),                                          lbl);  }