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

x33g5p2x  于2022-01-26 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(126)

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

Policies.builder介绍

[英]Returns a builder to create a new Policies object.
[中]返回用于创建新策略对象的生成器。

代码示例

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

/**
  * Builds the final object from this builder.
  *
  * <p>Any field that hasn't been set explicitly will get its default value.
  *
  * @return the object.
  */
 public Configuration build() {
  return new Configuration(
    policies != null ? policies : Policies.builder().build(),
    protocolOptions != null ? protocolOptions : new ProtocolOptions(),
    poolingOptions != null ? poolingOptions : new PoolingOptions(),
    socketOptions != null ? socketOptions : new SocketOptions(),
    metricsOptions != null ? metricsOptions : new MetricsOptions(),
    queryOptions != null ? queryOptions : new QueryOptions(),
    threadingOptions != null ? threadingOptions : new ThreadingOptions(),
    nettyOptions != null ? nettyOptions : NettyOptions.DEFAULT_INSTANCE,
    codecRegistry != null ? codecRegistry : CodecRegistry.DEFAULT_INSTANCE);
 }
}

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

private Policies getPolicies() {
  return Policies.builder()
      .withLoadBalancingPolicy(getLB())
      .build();
}

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

asyncSemaphore = new Semaphore(maxSyncJobs, true);
Policies.Builder polBuilder = Policies.builder();
if (this.addressTranslator == null) {
  addressTranslator = Policies.defaultAddressTranslator();

代码示例来源:origin: io.prestosql.cassandra/cassandra-driver

/**
   * Builds the final object from this builder.
   * <p/>
   * Any field that hasn't been set explicitly will get its default value.
   *
   * @return the object.
   */
  public Configuration build() {
    return new Configuration(
        policies != null ? policies : Policies.builder().build(),
        protocolOptions != null ? protocolOptions : new ProtocolOptions(),
        poolingOptions != null ? poolingOptions : new PoolingOptions(),
        socketOptions != null ? socketOptions : new SocketOptions(),
        metricsOptions != null ? metricsOptions : new MetricsOptions(),
        queryOptions != null ? queryOptions : new QueryOptions(),
        threadingOptions != null ? threadingOptions : new ThreadingOptions(),
        nettyOptions != null ? nettyOptions : NettyOptions.DEFAULT_INSTANCE,
        codecRegistry != null ? codecRegistry : CodecRegistry.DEFAULT_INSTANCE);
  }
}

代码示例来源: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());
}

代码示例来源:origin: com.yugabyte/cassandra-driver-core

/**
   * Builds the final object from this builder.
   * <p/>
   * Any field that hasn't been set explicitly will get its default value.
   *
   * @return the object.
   */
  public Configuration build() {
    return new Configuration(
        policies != null ? policies : Policies.builder().build(),
        protocolOptions != null ? protocolOptions : new ProtocolOptions(),
        poolingOptions != null ? poolingOptions : new PoolingOptions(),
        socketOptions != null ? socketOptions : new SocketOptions(),
        metricsOptions != null ? metricsOptions : new MetricsOptions(),
        queryOptions != null ? queryOptions : new QueryOptions(),
        threadingOptions != null ? threadingOptions : new ThreadingOptions(),
        nettyOptions != null ? nettyOptions : NettyOptions.DEFAULT_INSTANCE,
        codecRegistry != null ? codecRegistry : CodecRegistry.DEFAULT_INSTANCE);
  }
}

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-driver

/**
   * Builds the final object from this builder.
   * <p/>
   * Any field that hasn't been set explicitly will get its default value.
   *
   * @return the object.
   */
  public Configuration build() {
    return new Configuration(
        policies != null ? policies : Policies.builder().build(),
        protocolOptions != null ? protocolOptions : new ProtocolOptions(),
        poolingOptions != null ? poolingOptions : new PoolingOptions(),
        socketOptions != null ? socketOptions : new SocketOptions(),
        metricsOptions != null ? metricsOptions : new MetricsOptions(),
        queryOptions != null ? queryOptions : new QueryOptions(),
        threadingOptions != null ? threadingOptions : new ThreadingOptions(),
        nettyOptions != null ? nettyOptions : NettyOptions.DEFAULT_INSTANCE,
        codecRegistry != null ? codecRegistry : CodecRegistry.DEFAULT_INSTANCE);
  }
}

相关文章