public void onAdd(Host host) { HostConnectionPool previous = addHost(host); ; loadBalancer.onAdd(host); // This should not be necessary, especially since the host is // supposed to be new, but it's safer to make that work correctly // if the even is triggered multiple times. if (previous != null) previous.shutdown(); }