当前位置: 首页>>代码示例>>Java>>正文


Java PoolingOptions.setNewConnectionThreshold方法代码示例

本文整理汇总了Java中com.datastax.driver.core.PoolingOptions.setNewConnectionThreshold方法的典型用法代码示例。如果您正苦于以下问题:Java PoolingOptions.setNewConnectionThreshold方法的具体用法?Java PoolingOptions.setNewConnectionThreshold怎么用?Java PoolingOptions.setNewConnectionThreshold使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.datastax.driver.core.PoolingOptions的用法示例。


在下文中一共展示了PoolingOptions.setNewConnectionThreshold方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getReadPoolingOptions

import com.datastax.driver.core.PoolingOptions; //导入方法依赖的package包/类
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;
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:21,代码来源:CqlConfigHelper.java

示例2: setPoolingOptions

import com.datastax.driver.core.PoolingOptions; //导入方法依赖的package包/类
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());
    }
}
 
开发者ID:composable-systems,项目名称:dropwizard-cassandra,代码行数:15,代码来源:PoolingOptionsFactory.java

示例3: populatePoolingSettings

import com.datastax.driver.core.PoolingOptions; //导入方法依赖的package包/类
private Cluster.Builder populatePoolingSettings(Properties properties, Cluster.Builder builder) {
  String localCoreConnectionsPerHost = properties.getProperty(CassandraStoreParameters.LOCAL_CORE_CONNECTIONS_PER_HOST);
  String remoteCoreConnectionsPerHost = properties.getProperty(CassandraStoreParameters.REMOTE_CORE_CONNECTIONS_PER_HOST);
  String localMaxConnectionsPerHost = properties.getProperty(CassandraStoreParameters.LOCAL_MAX_CONNECTIONS_PER_HOST);
  String remoteMaxConnectionsPerHost = properties.getProperty(CassandraStoreParameters.REMOTE_MAX_CONNECTIONS_PER_HOST);
  String localNewConnectionThreshold = properties.getProperty(CassandraStoreParameters.LOCAL_NEW_CONNECTION_THRESHOLD);
  String remoteNewConnectionThreshold = properties.getProperty(CassandraStoreParameters.REMOTE_NEW_CONNECTION_THRESHOLD);
  String localMaxRequestsPerConnection = properties.getProperty(CassandraStoreParameters.LOCAL_MAX_REQUESTS_PER_CONNECTION);
  String remoteMaxRequestsPerConnection = properties.getProperty(CassandraStoreParameters.REMOTE_MAX_REQUESTS_PER_CONNECTION);
  PoolingOptions options = new PoolingOptions();
  if (localCoreConnectionsPerHost != null) {
    options.setCoreConnectionsPerHost(HostDistance.LOCAL, Integer.parseInt(localCoreConnectionsPerHost));
  }
  if (remoteCoreConnectionsPerHost != null) {
    options.setCoreConnectionsPerHost(HostDistance.REMOTE, Integer.parseInt(remoteCoreConnectionsPerHost));
  }
  if (localMaxConnectionsPerHost != null) {
    options.setMaxConnectionsPerHost(HostDistance.LOCAL, Integer.parseInt(localMaxConnectionsPerHost));
  }
  if (remoteMaxConnectionsPerHost != null) {
    options.setMaxConnectionsPerHost(HostDistance.REMOTE, Integer.parseInt(remoteMaxConnectionsPerHost));
  }
  if (localNewConnectionThreshold != null) {
    options.setNewConnectionThreshold(HostDistance.LOCAL, Integer.parseInt(localNewConnectionThreshold));
  }
  if (remoteNewConnectionThreshold != null) {
    options.setNewConnectionThreshold(HostDistance.REMOTE, Integer.parseInt(remoteNewConnectionThreshold));
  }
  if (localMaxRequestsPerConnection != null) {
    options.setMaxRequestsPerConnection(HostDistance.LOCAL, Integer.parseInt(localMaxRequestsPerConnection));
  }
  if (remoteMaxRequestsPerConnection != null) {
    options.setMaxRequestsPerConnection(HostDistance.REMOTE, Integer.parseInt(remoteMaxRequestsPerConnection));
  }
  builder = builder.withPoolingOptions(options);
  return builder;
}
 
开发者ID:apache,项目名称:gora,代码行数:38,代码来源:CassandraClient.java

示例4: populatePoolingSettings

import com.datastax.driver.core.PoolingOptions; //导入方法依赖的package包/类
private Builder populatePoolingSettings(Map<String, String> properties, Builder builder) {
    String localCoreConnectionsPerHost = properties.get(DBConstants.Cassandra.LOCAL_CORE_CONNECTIONS_PER_HOST);
    String remoteCoreConnectionsPerHost = properties.get(DBConstants.Cassandra.REMOTE_CORE_CONNECTIONS_PER_HOST);
    String localMaxConnectionsPerHost = properties.get(DBConstants.Cassandra.LOCAL_MAX_CONNECTIONS_PER_HOST);
    String remoteMaxConnectionsPerHost = properties.get(DBConstants.Cassandra.REMOTE_MAX_CONNECTIONS_PER_HOST);
    String localNewConnectionThreshold = properties.get(DBConstants.Cassandra.LOCAL_NEW_CONNECTION_THRESHOLD);
    String remoteNewConnectionThreshold = properties.get(DBConstants.Cassandra.REMOTE_NEW_CONNECTION_THRESHOLD);
    String localMaxRequestsPerConnection = properties.get(DBConstants.Cassandra.LOCAL_MAX_REQUESTS_PER_CONNECTION);
    String remoteMaxRequestsPerConnection = properties.get(DBConstants.Cassandra.REMOTE_MAX_REQUESTS_PER_CONNECTION);
    PoolingOptions options = new PoolingOptions();
    if (localCoreConnectionsPerHost != null) {
        options.setCoreConnectionsPerHost(HostDistance.LOCAL, Integer.parseInt(localCoreConnectionsPerHost));
    }
    if (remoteCoreConnectionsPerHost != null) {
        options.setCoreConnectionsPerHost(HostDistance.REMOTE, Integer.parseInt(remoteCoreConnectionsPerHost));
    }
    if (localMaxConnectionsPerHost != null) {
        options.setMaxConnectionsPerHost(HostDistance.LOCAL, Integer.parseInt(localMaxConnectionsPerHost));
    }
    if (remoteMaxConnectionsPerHost != null) {
        options.setMaxConnectionsPerHost(HostDistance.REMOTE, Integer.parseInt(remoteMaxConnectionsPerHost));
    }
    if (localNewConnectionThreshold != null) {
        options.setNewConnectionThreshold(HostDistance.LOCAL, Integer.parseInt(localNewConnectionThreshold));
    }
    if (remoteNewConnectionThreshold != null) {
        options.setNewConnectionThreshold(HostDistance.REMOTE, Integer.parseInt(remoteNewConnectionThreshold));
    }
    if (localMaxRequestsPerConnection != null) {
        options.setMaxRequestsPerConnection(HostDistance.LOCAL, Integer.parseInt(localMaxRequestsPerConnection));
    }
    if (remoteMaxRequestsPerConnection != null) {
        options.setMaxRequestsPerConnection(HostDistance.REMOTE, Integer.parseInt(remoteMaxRequestsPerConnection));
    }
    builder = builder.withPoolingOptions(options);
    return builder;
}
 
开发者ID:wso2,项目名称:carbon-data,代码行数:38,代码来源:CassandraConfig.java


注:本文中的com.datastax.driver.core.PoolingOptions.setNewConnectionThreshold方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。