Example #1
0
    public void onDown(Host host) {
      loadBalancer.onDown(host);
      HostConnectionPool pool = pools.remove(host);

      // This should not be necessary but it's harmless
      if (pool != null) pool.shutdown();

      // If we've remove a host, the loadBalancer is allowed to change his mind on host distances.
      for (Host h : cluster.getMetadata().allHosts()) {
        if (!h.getMonitor().isUp()) continue;

        HostDistance dist = loadBalancer.distance(h);
        if (dist != HostDistance.IGNORED) {
          HostConnectionPool p = pools.get(h);
          if (p == null) addHost(host);
          else p.hostDistance = dist;
        }
      }
    }
Example #2
0
 private void removePool(Host host) {
   HostConnectionPool pool = pools.remove(host);
   if (pool != null) pool.shutdown();
 }
Example #3
0
 public void onRemove(Host host) {
   loadBalancer.onRemove(host);
   HostConnectionPool pool = pools.remove(host);
   if (pool != null) pool.shutdown();
 }