com.datastax.driver.core.Configuration.builder()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(96)

本文整理了Java中com.datastax.driver.core.Configuration.builder()方法的一些代码示例,展示了Configuration.builder()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.builder()方法的具体详情如下:
包路径:com.datastax.driver.core.Configuration
类名称:Configuration
方法名:builder

Configuration.builder介绍

[英]Returns a builder to create a new Configuration object.

You only need this if you are building the configuration yourself. If you use Cluster#builder(), it will be done under the hood for you.
[中]

代码示例

代码示例来源:origin: com.github.ddth/ddth-cql-utils

Policies policies = polBuilder.build();
Configuration.Builder confBuilder = Configuration.builder();
if (this.metricsOptions != null) {
  confBuilder.withMetricsOptions(metricsOptions);

代码示例来源:origin: com.netflix.astyanax/astyanax-cql

public Configuration getJDConfig() {
  return Configuration.builder()
      .withPolicies(getPolicies())
      .withProtocolOptions(getProtocolOptions())
      .withPoolingOptions(getPoolingOptions())
      .withSocketOptions(getSocketOptions())
      .withMetricsOptions(getMetricsOptions())
      .withQueryOptions(getQueryOptions())
      .build();
}

代码示例来源:origin: com.netflix.astyanax/astyanax-test

private static AstyanaxContext<Keyspace> keyspaceWithJavaDriver(String keyspaceName) {
  final String SEEDS = "localhost";
  Supplier<List<Host>> HostSupplier = new Supplier<List<Host>>() {
    @Override
    public List<Host> get() {
      Host host = new Host(SEEDS, -1);
      return Collections.singletonList(host);
    }
  };
  
  ProtocolOptions protocolOptions = new ProtocolOptions(9042);
  
  Configuration jdConfig = Configuration.builder()
      .withProtocolOptions(protocolOptions)
      .build();
  AstyanaxContext<Keyspace> context = new AstyanaxContext.Builder()
  .forKeyspace(keyspaceName)
  .withHostSupplier(HostSupplier)
  .withAstyanaxConfiguration(new AstyanaxConfigurationImpl())
  .withConnectionPoolConfiguration(new JavaDriverConnectionPoolConfigurationImpl(jdConfig))
  .buildKeyspace(CqlFamilyFactory.getInstance());
  return context;
}

代码示例来源:origin: com.netflix.astyanax/astyanax-cql

public JavaDriverConnectionPoolConfigurationImpl build() {
  Policies policies = Policies.builder()
      .withLoadBalancingPolicy(loadBalancingPolicy)
      .withReconnectionPolicy(reconnectionPolicy)
      .withRetryPolicy(retryPolicy).build();
  ProtocolOptions protocolOptions = (nativeProtocolPort == -1) ? new ProtocolOptions() : new ProtocolOptions(nativeProtocolPort);
  MetricsOptions metricsOptions = new MetricsOptions(true, jmxReportingEnabled);
  return new JavaDriverConnectionPoolConfigurationImpl(Configuration.builder()
      .withPolicies(policies)
      .withProtocolOptions(protocolOptions)
      .withPoolingOptions(poolingOptions)
      .withSocketOptions(socketOptions)
      .withMetricsOptions(metricsOptions)
      .withQueryOptions(queryOptions).build());
}

相关文章