@Override public void onReset() { rebuildPartitions(); } });
@Override public void onReset() { rebuildPartitions(); } });
@Override public void onUpdate() { rebuildPartitions(); }
@Override public void onUpdate() { rebuildPartitions(); }
/** * @param ring */ @Override public synchronized void setHosts(Collection<Host> ring) { // Temporary list of hosts to remove. Any host not in the new ring will // be removed Set<Host> hostsToRemove = Sets.newHashSet(hosts.keySet()); // Add new hosts. boolean changed = false; for (Host host : ring) { if (addHost(host, false)) changed = true; hostsToRemove.remove(host); } // Remove any hosts that are no longer in the ring for (Host host : hostsToRemove) { removeHost(host, false); changed = true; } if (changed) { topology.setPools(hosts.values()); rebuildPartitions(); } }
/** * @param ring */ @Override public synchronized void setHosts(Collection<Host> ring) { // Temporary list of hosts to remove. Any host not in the new ring will // be removed Set<Host> hostsToRemove = Sets.newHashSet(hosts.keySet()); // Add new hosts. boolean changed = false; for (Host host : ring) { if (addHost(host, false)) changed = true; hostsToRemove.remove(host); } // Remove any hosts that are no longer in the ring for (Host host : hostsToRemove) { removeHost(host, false); changed = true; } if (changed) { topology.setPools(hosts.values()); rebuildPartitions(); } }
/** * Remove host from the system. Shuts down pool associated with the host and rebuilds partition map * @param host * @param refresh */ @Override public synchronized boolean removeHost(Host host, boolean refresh) { HostConnectionPool<CL> pool = hosts.remove(host); if (pool != null) { topology.removePool(pool); rebuildPartitions(); monitor.onHostRemoved(host); pool.shutdown(); return true; } else { return false; } }
/** * Remove host from the system. Shuts down pool associated with the host and rebuilds partition map * @param host * @param refresh */ @Override public synchronized boolean removeHost(Host host, boolean refresh) { HostConnectionPool<CL> pool = hosts.remove(host); if (pool != null) { topology.removePool(pool); rebuildPartitions(); monitor.onHostRemoved(host); pool.shutdown(); return true; } else { return false; } }
if (refresh) { topology.addPool(pool); rebuildPartitions();
if (refresh) { topology.addPool(pool); rebuildPartitions();