public JavaDriverConfigBuilder withMinRequestsPerConnection(HostDistance distance, int minRequests) { this.poolingOptions.setNewConnectionThreshold(distance, minRequests); return this; }
private HostConnectionPool createPool(Cluster cluster, int coreConnections, int maxConnections) { cluster .getConfiguration() .getPoolingOptions() .setNewConnectionThreshold(HostDistance.LOCAL, 100) .setMaxRequestsPerConnection(HostDistance.LOCAL, 128) .setMaxConnectionsPerHost(HostDistance.LOCAL, maxConnections) .setCoreConnectionsPerHost(HostDistance.LOCAL, coreConnections); Session session = cluster.connect(); Host host = TestUtils.findHost(cluster, 1); // Replace the existing pool with a spy pool and return it. SessionManager sm = ((SessionManager) session); return sm.pools.get(host); }
options.setNewConnectionThreshold(LOCAL, -1); fail("expected an IllegalArgumentException"); } catch (IllegalArgumentException e) {
.setNewConnectionThreshold(HostDistance.LOCAL, getConfiguration().getNewConnectionThresholdLocal()) .setNewConnectionThreshold(HostDistance.REMOTE, getConfiguration().getNewConnectionThresholdRemote()); builder.withPoolingOptions(poolingOptions);
private static PoolingOptions getReadPoolingOptions(Configuration conf) { Optional<Integer> coreConnections = getInputCoreConnections(conf); Optional<Integer> maxConnections = getInputMaxConnections(conf); Optional<Integer> maxSimultaneousRequests = getInputMaxSimultReqPerConnections(conf); PoolingOptions poolingOptions = new PoolingOptions(); for (HostDistance hostDistance : Arrays.asList(HostDistance.LOCAL, HostDistance.REMOTE)) { if (coreConnections.isPresent()) poolingOptions.setCoreConnectionsPerHost(hostDistance, coreConnections.get()); if (maxConnections.isPresent()) poolingOptions.setMaxConnectionsPerHost(hostDistance, maxConnections.get()); if (maxSimultaneousRequests.isPresent()) poolingOptions.setNewConnectionThreshold(hostDistance, maxSimultaneousRequests.get()); } return poolingOptions; }
private static PoolingOptions getReadPoolingOptions(Configuration conf) { Optional<Integer> coreConnections = getInputCoreConnections(conf); Optional<Integer> maxConnections = getInputMaxConnections(conf); Optional<Integer> maxSimultaneousRequests = getInputMaxSimultReqPerConnections(conf); PoolingOptions poolingOptions = new PoolingOptions(); for (HostDistance hostDistance : Arrays.asList(HostDistance.LOCAL, HostDistance.REMOTE)) { if (coreConnections.isPresent()) poolingOptions.setCoreConnectionsPerHost(hostDistance, coreConnections.get()); if (maxConnections.isPresent()) poolingOptions.setMaxConnectionsPerHost(hostDistance, maxConnections.get()); if (maxSimultaneousRequests.isPresent()) poolingOptions.setNewConnectionThreshold(hostDistance, maxSimultaneousRequests.get()); } return poolingOptions; }
options.setNewConnectionThreshold(HostDistance.LOCAL, Integer.parseInt(localNewConnectionThreshold)); options.setNewConnectionThreshold(HostDistance.REMOTE, Integer.parseInt(remoteNewConnectionThreshold));
options.setNewConnectionThreshold(HostDistance.LOCAL, Integer.parseInt(localNewConnectionThreshold)); options.setNewConnectionThreshold(HostDistance.REMOTE, Integer.parseInt(remoteNewConnectionThreshold));
options.setNewConnectionThreshold(HostDistance.LOCAL, Integer.parseInt(localNewConnectionThreshold)); options.setNewConnectionThreshold(HostDistance.REMOTE, Integer.parseInt(remoteNewConnectionThreshold));
void setNewConnectionThreshold(PoolingOptions poolingOptions) { if (newConnectionThreshold != null) { int currentNewConnectionThreshold = poolingOptions.getNewConnectionThreshold(getHostDistance()); if (currentNewConnectionThreshold < newConnectionThreshold) { poolingOptions.setNewConnectionThreshold(getHostDistance(), newConnectionThreshold); } } }
PoolingOptions setNewConnectionThreshold(PoolingOptions poolingOptions) { if (newConnectionThreshold != null) { int currentNewConnectionThreshold = poolingOptions.getNewConnectionThreshold(getHostDistance()); if (currentNewConnectionThreshold < newConnectionThreshold) { poolingOptions.setNewConnectionThreshold(getHostDistance(), newConnectionThreshold); } } return poolingOptions; }
poolingOptions.setConnectionsPerHost(HostDistance.REMOTE, 1, 1) .setMaxRequestsPerConnection(HostDistance.REMOTE, 1024) .setNewConnectionThreshold(HostDistance.REMOTE, 256); poolingOptions.setConnectionsPerHost(HostDistance.LOCAL, 1, 2) .setMaxRequestsPerConnection(HostDistance.LOCAL, 16 * 1024) .setNewConnectionThreshold(HostDistance.LOCAL, 12 * 1024); poolingOptions.setHeartbeatIntervalSeconds(10); poolingOptions.setPoolTimeoutMillis(1000);
private static PoolingOptions getReadPoolingOptions(Configuration conf) { Optional<Integer> coreConnections = getInputCoreConnections(conf); Optional<Integer> maxConnections = getInputMaxConnections(conf); Optional<Integer> maxSimultaneousRequests = getInputMaxSimultReqPerConnections(conf); PoolingOptions poolingOptions = new PoolingOptions(); for (HostDistance hostDistance : Arrays.asList(HostDistance.LOCAL, HostDistance.REMOTE)) { if (coreConnections.isPresent()) poolingOptions.setCoreConnectionsPerHost(hostDistance, coreConnections.get()); if (maxConnections.isPresent()) poolingOptions.setMaxConnectionsPerHost(hostDistance, maxConnections.get()); if (maxSimultaneousRequests.isPresent()) poolingOptions.setNewConnectionThreshold(hostDistance, maxSimultaneousRequests.get()); } return poolingOptions; }
private void setPoolingOptions(PoolingOptions poolingOptions, HostDistance hostDistance, HostDistanceOptions options) { if (options.getCoreConnections() != null) { poolingOptions.setCoreConnectionsPerHost(hostDistance, options.getCoreConnections()); } if (options.getMaxConnections() != null) { poolingOptions.setMaxConnectionsPerHost(hostDistance, options.getMaxConnections()); } if (options.getMaxRequestsPerConnection() != null) { poolingOptions.setMaxRequestsPerConnection(hostDistance, options.getMaxRequestsPerConnection()); } if (options.getNewConnectionThreshold() != null) { poolingOptions.setNewConnectionThreshold(hostDistance, options.getNewConnectionThreshold()); } }
private void setPoolingOptions(PoolingOptions poolingOptions, HostDistance hostDistance, HostDistanceOptions options) { if (options.getCoreConnections() != null) { poolingOptions.setCoreConnectionsPerHost(hostDistance, options.getCoreConnections()); } if (options.getMaxConnections() != null) { poolingOptions.setMaxConnectionsPerHost(hostDistance, options.getMaxConnections()); } if (options.getMaxRequestsPerConnection() != null) { poolingOptions.setMaxRequestsPerConnection(hostDistance, options.getMaxRequestsPerConnection()); } if (options.getNewConnectionThreshold() != null) { poolingOptions.setNewConnectionThreshold(hostDistance, options.getNewConnectionThreshold()); } }
private HostConnectionPool createPool(Cluster cluster, int coreConnections, int maxConnections) { cluster .getConfiguration() .getPoolingOptions() .setNewConnectionThreshold(HostDistance.LOCAL, 100) .setMaxRequestsPerConnection(HostDistance.LOCAL, 128) .setMaxConnectionsPerHost(HostDistance.LOCAL, maxConnections) .setCoreConnectionsPerHost(HostDistance.LOCAL, coreConnections); Session session = cluster.connect(); Host host = TestUtils.findHost(cluster, 1); // Replace the existing pool with a spy pool and return it. SessionManager sm = ((SessionManager) session); return sm.pools.get(host); }
poolingOptions.setNewConnectionThreshold(HostDistance.LOCAL, new_connection_threshold_local); poolingOptions.setNewConnectionThreshold(HostDistance.REMOTE, new_connection_threshold_remote);
poolingOptions.setNewConnectionThreshold(HostDistance.LOCAL, new_connection_threshold_local); poolingOptions.setNewConnectionThreshold(HostDistance.REMOTE, new_connection_threshold_remote);
poolOptions.setMaxRequestsPerConnection(HostDistance.REMOTE, config.getAdditionalProperty("maxRequestsPerConnectionRemote", 200)); poolOptions.setNewConnectionThreshold(HostDistance.LOCAL, config.getAdditionalProperty("newConnectionThresholdLocal", 1024)); poolOptions.setNewConnectionThreshold(HostDistance.REMOTE, config.getAdditionalProperty("newConnectionThresholdRemote", 256)); builder.withPoolingOptions(poolOptions);
options.setNewConnectionThreshold(LOCAL, -1); fail("expected an IllegalArgumentException"); } catch (IllegalArgumentException e) {