@Override public Integer getValue() { return manager.metadata.allHosts().size(); } });
/** * Returns the known hosts of this cluster. * * @return A set will all the know host of this cluster. */ public Set<Host> getAllHosts() { return new HashSet<Host>(allHosts()); }
void connect() throws UnsupportedProtocolVersionException { if (isShutdown) return; // NB: at this stage, allHosts() only contains the initial contact points List<Host> hosts = new ArrayList<Host>(cluster.metadata.allHosts()); // shuffle so that multiple clients with the same contact points don't all pick the same control // host Collections.shuffle(hosts); setNewConnection(reconnectInternal(hosts.iterator(), true)); }
if (!initFuture.compareAndSet(null, myInitFuture)) return initFuture.get(); Collection<Host> hosts = cluster.getMetadata().allHosts(); ListenableFuture<?> allPoolsCreatedFuture = createPools(hosts); ListenableFuture<?> allPoolsUpdatedFuture =
List<ListenableFuture<Boolean>> poolCreatedFutures = Lists.newArrayList(); for (Host h : cluster.getMetadata().allHosts()) { HostDistance dist = loadBalancingPolicy().distance(h); HostConnectionPool pool = pools.get(h);
public static Host findHost(Cluster cluster, String address) { // Note: we can't rely on ProtocolOptions.getPort() to build an InetSocketAddress and call // metadata.getHost, // because the port doesn't have the correct value if addContactPointsWithPorts was used to // create the Cluster // (JAVA-860 will solve that) for (Host host : cluster.getMetadata().allHosts()) { if (host.getAddress().getHostAddress().equals(address)) return host; } return null; }
for (Host host : cluster.metadata.allHosts()) if (!host.getSocketAddress().equals(connection.address) && !foundHostsSet.contains(host.getSocketAddress()))
@Override public Integer getValue() { return manager.metadata.allHosts().size(); } });
/** * Returns the known hosts of this cluster. * * @return A set will all the know host of this cluster. */ public Set<Host> getAllHosts() { return new HashSet<Host>(allHosts()); }
@Override public Integer getValue() { return manager.metadata.allHosts().size(); } });
/** * Returns the known hosts of this cluster. * * @return A set will all the know host of this cluster. */ public Set<Host> getAllHosts() { return new HashSet<Host>(allHosts()); }
@Override public Integer getValue() { return manager.metadata.allHosts().size(); } });
/** * Returns the known hosts of this cluster. * * @return A set will all the know host of this cluster. */ public Set<Host> getAllHosts() { return new HashSet<Host>(allHosts()); }
@Test(groups = "short") public void should_init_cluster_and_session_if_needed() throws Exception { // For this test we need an uninitialized cluster, so we can't reuse the one provided by the // parent class. Rebuild a new one with the same (unique) host. Host host = cluster().getMetadata().allHosts().iterator().next(); Cluster cluster2 = register( Cluster.builder() .addContactPointsWithPorts(Lists.newArrayList(host.getSocketAddress())) .build()); try { Session session2 = cluster2.newSession(); // Neither cluster2 nor session2 are initialized at this point assertThat(cluster2.manager.metadata).isNull(); ResultSetFuture future = session2.executeAsync("select release_version from system.local"); Row row = Uninterruptibles.getUninterruptibly(future).one(); assertThat(row.getString(0)).isNotEmpty(); } finally { cluster2.close(); } }
for (Host host : cluster().getMetadata().allHosts()) { assertThat(host.getTokens()).hasSize(numTokens);
Collection<Host> allHosts = metadata.allHosts();
void connect() throws UnsupportedProtocolVersionException { if (isShutdown) return; // NB: at this stage, allHosts() only contains the initial contact points List<Host> hosts = new ArrayList<Host>(cluster.metadata.allHosts()); // shuffle so that multiple clients with the same contact points don't all pick the same control host Collections.shuffle(hosts); setNewConnection(reconnectInternal(hosts.iterator(), true)); }
void connect() throws UnsupportedProtocolVersionException { if (isShutdown) return; // NB: at this stage, allHosts() only contains the initial contact points List<Host> hosts = new ArrayList<Host>(cluster.metadata.allHosts()); // shuffle so that multiple clients with the same contact points don't all pick the same control host Collections.shuffle(hosts); setNewConnection(reconnectInternal(hosts.iterator(), true)); }
void connect() throws UnsupportedProtocolVersionException { if (isShutdown) return; // NB: at this stage, allHosts() only contains the initial contact points List<Host> hosts = new ArrayList<Host>(cluster.metadata.allHosts()); // shuffle so that multiple clients with the same contact points don't all pick the same control host Collections.shuffle(hosts); setNewConnection(reconnectInternal(hosts.iterator(), true)); }
public static Host findHost(Cluster cluster, String address) { // Note: we can't rely on ProtocolOptions.getPort() to build an InetSocketAddress and call // metadata.getHost, // because the port doesn't have the correct value if addContactPointsWithPorts was used to // create the Cluster // (JAVA-860 will solve that) for (Host host : cluster.getMetadata().allHosts()) { if (host.getAddress().getHostAddress().equals(address)) return host; } return null; }