@Override public void onReset() { 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(); } }
HostConnectionPool<CL> pool = newHostConnectionPool(host, factory, config); if (null == hosts.putIfAbsent(host, pool)) { try { if (refresh) { topology.addPool(pool); rebuildPartitions();
/** * Starts the conn pool and resources associated with it */ @Override public void start() { ConnectionPoolMBeanManager.getInstance().registerMonitor(config.getName(), this); String seeds = config.getSeeds(); if (seeds != null && !seeds.isEmpty()) { setHosts(config.getSeedHosts()); } config.getLatencyScoreStrategy().start(new Listener() { @Override public void onUpdate() { rebuildPartitions(); } @Override public void onReset() { rebuildPartitions(); } }); }
do { try { OperationResult<R> result = newExecuteWithFailover(op).tryOperation(op); retry.success(); if(context != null)
/** * @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(); } }
HostConnectionPool<CL> pool = newHostConnectionPool(host, factory, config); if (null == hosts.putIfAbsent(host, pool)) { try { if (refresh) { topology.addPool(pool); rebuildPartitions();
/** * Starts the conn pool and resources associated with it */ @Override public void start() { ConnectionPoolMBeanManager.getInstance().registerMonitor(config.getName(), this); String seeds = config.getSeeds(); if (seeds != null && !seeds.isEmpty()) { setHosts(config.getSeedHosts()); } config.getLatencyScoreStrategy().start(new Listener() { @Override public void onUpdate() { rebuildPartitions(); } @Override public void onReset() { rebuildPartitions(); } }); }
do { try { OperationResult<R> result = newExecuteWithFailover(op).tryOperation(op); retry.success(); if(context != null)
@Override public void onReset() { rebuildPartitions(); } });
@Override public void onUpdate() { rebuildPartitions(); }
@Override public void onUpdate() { 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; } }