Ejemplo n.º 1
0
 public boolean execute(Object o) {
   if (o instanceof HealthMonitorRequest) {
     HealthMonitorRequest hmr = (HealthMonitorRequest) o;
     return (hmr.getRequestType() == HealthMonitorRequest.LOAD_BALANCE);
   }
   return false;
 }
Ejemplo n.º 2
0
  public void execute() {
    // Publish queued LB requests
    pubishLoadBalancerRequests();

    for (Iterator it = healthMonitorRequests.getAddedCollection().iterator(); it.hasNext(); ) {
      HealthMonitorRequest hsm = (HealthMonitorRequest) it.next();
      if (hsm.getRequestType() == HealthMonitorRequest.LOAD_BALANCE) {
        doLoadBalance();
      }
    }

    for (Iterator it = loadBalanceRequests.getChangedCollection().iterator(); it.hasNext(); ) {
      LoadBalanceRequest lbr = (LoadBalanceRequest) it.next();
      if (lbr.isResult()) {
        CougaarSociety society = lbr.getCougaarSociety();
        if (society != null) {
          if (logger.isDebugEnabled()) {
            logger.debug("LoadBalancer result: \n" + society.toXML());
          }
          Map layout = layoutFromSociety(society);
          if (lbr instanceof UniqueLoadBalanceRequest) {
            UniqueLoadBalanceRequest ulbr = (UniqueLoadBalanceRequest) lbr;
            LoadBalancerListener listener = (LoadBalancerListener) myRequests.remove(ulbr.getUID());
            if (listener != null) {
              listener.layoutReady(layout);
            }
          }
        }
      }
    }
  }