.withPoolingOptions(new PoolingOptions().setConnectionsPerHost(HostDistance.LOCAL, m_clusterConfiguration.getConnectionsLocalCore(), m_clusterConfiguration.getConnectionsLocalMax()) .setConnectionsPerHost(HostDistance.REMOTE,
.withCompression(ProtocolOptions.Compression.LZ4) .withLoadBalancingPolicy(loadBalancingPolicy) .withPoolingOptions(poolingOptions) .withQueryOptions(queryOptions) .withSocketOptions(socketOptions)
builder = builder.withPoolingOptions(poolingOptions);
Cluster cluster = createClusterBuilder() .withPoolingOptions(new PoolingOptions().setIdleTimeoutSeconds(20)) .build(); List<MockRequest> allRequests = newArrayList();
.addContactPoints(getContactPoints().get(0)) .withPort(ccm().getBinaryPort()) .withPoolingOptions( new PoolingOptions() .setConnectionsPerHost(
Cluster cluster = createClusterBuilder() .withPoolingOptions(new PoolingOptions().setIdleTimeoutSeconds(20)) .build(); List<MockRequest> allRequests = newArrayList();
.addContactPoints(getContactPoints().get(0)) .withPort(ccm().getBinaryPort()) .withPoolingOptions(poolingOptions) .withLoadBalancingPolicy(loadBalancingPolicy) .withReconnectionPolicy(new ConstantReconnectionPolicy(1000))
.addContactPoint(TestUtils.ipOfNode(1)) .withPort(scassandra.getBinaryPort()) .withPoolingOptions( new PoolingOptions() .setCoreConnectionsPerHost(HostDistance.LOCAL, 1)
.addContactPoints(hostAddress.getAddress()) .withPort(scassandra.getBinaryPort()) .withPoolingOptions(new PoolingOptions().setHeartbeatIntervalSeconds(3)) .build();
Cluster cluster = createClusterBuilder() .withPoolingOptions(new PoolingOptions().setIdleTimeoutSeconds(20)) .build(); List<MockRequest> allRequests = newArrayList();
.addContactPoints(hostAddress.getAddress()) .withPort(scassandra.getBinaryPort()) .withPoolingOptions(new PoolingOptions().setHeartbeatIntervalSeconds(0)) .build();
@BeforeMethod(groups = "short") public void beforeMethod() { scassandras = ScassandraCluster.builder().withNodes(3).build(); scassandras.init(); cluster = Cluster.builder() .addContactPoints(scassandras.address(1).getAddress()) .withPort(scassandras.getBinaryPort()) .withRetryPolicy(retryPolicy) .withLoadBalancingPolicy(new SortingLoadBalancingPolicy()) .withPoolingOptions( new PoolingOptions() .setCoreConnectionsPerHost(HostDistance.LOCAL, 1) .setMaxConnectionsPerHost(HostDistance.LOCAL, 1) .setHeartbeatIntervalSeconds(0)) .withNettyOptions(nonQuietClusterCloseOptions) // Mark everything as idempotent by default so RetryPolicy is exercised. .withQueryOptions(new QueryOptions().setDefaultIdempotence(true)) .build(); session = cluster.connect(); host1 = TestUtils.findHost(cluster, 1); host2 = TestUtils.findHost(cluster, 2); host3 = TestUtils.findHost(cluster, 3); errors = cluster.getMetrics().getErrorMetrics(); Mockito.reset(retryPolicy); for (Scassandra node : scassandras.nodes()) { node.activityClient().clearAllRecordedActivity(); } }
private void copyPoolingOptions(Builder builder) { PoolingOptions opts = new PoolingOptions(); opts.setCoreConnectionsPerHost(HostDistance.REMOTE, remoteCoreConnectionsPerHost); opts.setCoreConnectionsPerHost(HostDistance.LOCAL, localCoreConnectionsPerHost); opts.setMaxConnectionsPerHost(HostDistance.REMOTE, remoteMaxConnectionsPerHost); opts.setMaxConnectionsPerHost(HostDistance.LOCAL, localMaxConnectionsPerHost); opts.setMaxSimultaneousRequestsPerConnectionThreshold( HostDistance.REMOTE, remoteMaxSimultaneousRequestsPerConnectionThreshold); opts.setMaxSimultaneousRequestsPerConnectionThreshold( HostDistance.LOCAL, localMaxSimultaneousRequestsPerConnectionThreshold); opts.setMinSimultaneousRequestsPerConnectionThreshold( HostDistance.REMOTE, remoteMinSimultaneousRequestsPerConnectionThreshold); opts.setMinSimultaneousRequestsPerConnectionThreshold( HostDistance.LOCAL, localMinSimultaneousRequestsPerConnectionThreshold); builder.withPoolingOptions(opts); }
/** * Ensures that authentication is possible even if the server is busy during SASL handshake. * * @jira_ticket JAVA-1429 */ @Test(groups = "short") @CCMConfig(dirtiesContext = true) public void should_connect_with_slow_server() { Cluster cluster = Cluster.builder() .addContactPoints(getContactPoints()) .withPort(ccm().getBinaryPort()) .withAuthProvider(new SlowAuthProvider()) .withPoolingOptions(new PoolingOptions().setHeartbeatIntervalSeconds(1)) .build(); cluster.connect(); }
private void createCluster(int core, int max) { PoolingOptions poolingOptions = new PoolingOptions().setConnectionsPerHost(LOCAL, core, max); SocketOptions socketOptions = new SocketOptions().setReadTimeoutMillis(1000); cluster = Cluster.builder() .addContactPoints(scassandra.address(1).getAddress()) .withPort(scassandra.getBinaryPort()) .withQueryOptions(nonDebouncingQueryOptions()) .withPoolingOptions(poolingOptions) .withSocketOptions(socketOptions) .withReconnectionPolicy(new ConstantReconnectionPolicy(1000)) .build(); cluster.connect(); }
@Override public Cluster.Builder createClusterBuilder() { channelMonitor = register(new SocketChannelMonitor()); PoolingOptions poolingOptions = new PoolingOptions().setConnectionsPerHost(HostDistance.LOCAL, 8, 8); return Cluster.builder() .withPoolingOptions(poolingOptions) .withNettyOptions(channelMonitor.nettyOptions()) .withReconnectionPolicy(new ConstantReconnectionPolicy(1000)); }
@Override public Cluster.Builder createClusterBuilder() { executor = spy( new ThreadPoolExecutor( 1, 1, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>())); PoolingOptions poolingOptions = new PoolingOptions(); poolingOptions.setInitializationExecutor(executor); return Cluster.builder().withPoolingOptions(poolingOptions); }
CreateClusterAndCheckConnections(CountDownLatch startSignal) { this.startSignal = startSignal; this.cluster = Cluster.builder() .addContactPoints(getContactPoints()) .withPort(ccm().getBinaryPort()) .withPoolingOptions( new PoolingOptions().setCoreConnectionsPerHost(HostDistance.LOCAL, 1)) .withNettyOptions(channelMonitor.nettyOptions()) .build(); }
protected Cluster.Builder createClusterBuilder() { return Cluster.builder() .withPort(scassandra.getBinaryPort()) .addContactPoints(hostAddress.getAddress()) .withPort(scassandra.getBinaryPort()) .withPoolingOptions( new PoolingOptions() .setCoreConnectionsPerHost(HostDistance.LOCAL, 1) .setMaxConnectionsPerHost(HostDistance.LOCAL, 1) .setHeartbeatIntervalSeconds(0)); }
poolOps.setMaxRequestsPerConnection(HostDistance.LOCAL, cassandraConf.getMaxRequestPerConnectionLocal()); poolOps.setMaxRequestsPerConnection(HostDistance.REMOTE, cassandraConf.getMaxRequestPerConnectionRemote()); cluster.withPoolingOptions(poolOps);