/** * Returns the {@code Cluster} object this session is part of. * * @return the {@code Cluster} object this session is part of. */ @Override public Cluster getCluster() { return session.getCluster(); }
/** * Returns the {@code Cluster} object this session is part of. * * @return the {@code Cluster} object this session is part of. */ @Override public Cluster getCluster() { return session.getCluster(); }
/** * Returns the {@code Cluster} object this session is part of. * * @return the {@code Cluster} object this session is part of. */ @Override public Cluster getCluster() { return session.getCluster(); }
private void createKeyspace(Metadata metadata) { Statement createKeyspaceStatement = null; // Find out which node is closest and use that for the networktopologystrategy LoadBalancingPolicy lbPolicy = session.getCluster().getConfiguration().getPolicies().getLoadBalancingPolicy(); for (Host host : metadata.getAllHosts()) { if (lbPolicy.distance(host) == HostDistance.LOCAL) { createKeyspaceStatement = KeyspaceBuilder.create(keyspace) .ifNotExists() .networkTopologyStrategy() .dc(host.getDatacenter(), 1); break; } } if (createKeyspaceStatement == null) { fail("Could not find a local host for the test"); return; } session.execute(createKeyspaceStatement); }