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

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

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

Policies.defaultRetryPolicy介绍

[英]The default retry policy.

The default retry policy is DefaultRetryPolicy.
[中]默认重试策略。
默认重试策略为DefaultRetryPolicy。

代码示例

代码示例来源: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 Policies build() {
  return new Policies(
    loadBalancingPolicy == null ? defaultLoadBalancingPolicy() : loadBalancingPolicy,
    reconnectionPolicy == null ? defaultReconnectionPolicy() : reconnectionPolicy,
    retryPolicy == null ? defaultRetryPolicy() : retryPolicy,
    addressTranslator == null ? defaultAddressTranslator() : addressTranslator,
    timestampGenerator == null ? defaultTimestampGenerator() : timestampGenerator,
    speculativeExecutionPolicy == null
      ? defaultSpeculativeExecutionPolicy()
      : speculativeExecutionPolicy);
 }
}

代码示例来源:origin: cumulusrdf/cumulusrdf

/**
 * Returns the retry balancing policy according with a given configuration.
 * 
 * @param configuration the configuration.
 * @return the retry balancing policy according with a given configuration.
 */
private RetryPolicy retryPolicy(final Configuration<Map<String, Object>> configuration) {
  RetryPolicy retryPolicy = Policies.defaultRetryPolicy();
  try {
    String retryPolicyClassName = configuration.getAttribute(RETRY_POLICY, null);
    if (retryPolicyClassName != null) {
      retryPolicy = (RetryPolicy) Class.forName(retryPolicyClassName).newInstance();                        
    }
  } catch (final Exception ignore) {
    // just use the default value.
  }
  return retryPolicy;
}

代码示例来源:origin: cumulusrdf/cumulusrdf

/**
 * Returns the retry balancing policy according with a given configuration.
 * 
 * @param configuration the configuration.
 * @return the retry balancing policy according with a given configuration.
 */
private RetryPolicy retryPolicy(final Configuration<Map<String, Object>> configuration) {
  RetryPolicy retryPolicy = Policies.defaultRetryPolicy();
  try {
    String retryPolicyClassName = configuration.getAttribute(RETRY_POLICY, null);
    if (retryPolicyClassName != null) {
      retryPolicy = (RetryPolicy) Class.forName(retryPolicyClassName).newInstance();                        
    }
  } catch (final Exception ignore) {
    // just use the default value.
  }
  return retryPolicy;
}

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

public Policies() {
  this(defaultLoadBalancingPolicy(), defaultReconnectionPolicy(), defaultRetryPolicy(), defaultAddressTranslater());
}

代码示例来源:origin: com.bazaarvoice.emodb/emodb-common-astyanax

_retryPolicy = Objects.firstNonNull(_retryPolicy, Policies.defaultRetryPolicy());

代码示例来源:origin: bazaarvoice/emodb

_retryPolicy = Objects.firstNonNull(_retryPolicy, Policies.defaultRetryPolicy());

代码示例来源:origin: com.bazaarvoice.emodb/emodb-common-astyanax

.withPoolingOptions(poolingOptions)
.withSocketOptions(socketOptions)
.withRetryPolicy(Policies.defaultRetryPolicy())
.withAuthProvider(authProvider);

代码示例来源: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 Policies build() {
    return new Policies(
        loadBalancingPolicy == null ? defaultLoadBalancingPolicy() : loadBalancingPolicy,
        reconnectionPolicy == null ? defaultReconnectionPolicy() : reconnectionPolicy,
        retryPolicy == null ? defaultRetryPolicy() : retryPolicy,
        addressTranslator == null ? defaultAddressTranslator() : addressTranslator,
        timestampGenerator == null ? defaultTimestampGenerator() : timestampGenerator,
        speculativeExecutionPolicy == null ? defaultSpeculativeExecutionPolicy() : speculativeExecutionPolicy);
  }
}

代码示例来源:origin: bazaarvoice/emodb

.withPoolingOptions(poolingOptions)
.withSocketOptions(socketOptions)
.withRetryPolicy(Policies.defaultRetryPolicy())
.withAuthProvider(authProvider);

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

retryPolicy = Policies.defaultRetryPolicy();

代码示例来源: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 Policies build() {
    return new Policies(
        loadBalancingPolicy == null ? Policies.defaultLoadBalancingPolicy() : loadBalancingPolicy,
        Objects.firstNonNull(reconnectionPolicy, Policies.defaultReconnectionPolicy()),
        Objects.firstNonNull(retryPolicy, Policies.defaultRetryPolicy()),
        Objects.firstNonNull(addressTranslator, Policies.defaultAddressTranslator()),
        Objects.firstNonNull(timestampGenerator, Policies.defaultTimestampGenerator()),
        Objects.firstNonNull(speculativeExecutionPolicy, Policies.defaultSpeculativeExecutionPolicy()));
  }
}

代码示例来源: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 Policies build() {
    return new Policies(
        loadBalancingPolicy == null ? Policies.defaultLoadBalancingPolicy() : loadBalancingPolicy,
        Objects.firstNonNull(reconnectionPolicy, Policies.defaultReconnectionPolicy()),
        Objects.firstNonNull(retryPolicy, Policies.defaultRetryPolicy()),
        Objects.firstNonNull(addressTranslator, Policies.defaultAddressTranslator()),
        Objects.firstNonNull(timestampGenerator, Policies.defaultTimestampGenerator()),
        Objects.firstNonNull(speculativeExecutionPolicy, Policies.defaultSpeculativeExecutionPolicy()));
  }
}

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

/**
 * The configuration that will be used for the new cluster.
 * <p>
 * You <b>should not</b> modify this object directly because changes made
 * to the returned object may not be used by the cluster build.
 * Instead, you should use the other methods of this {@code Builder}.
 *
 * @return the configuration to use for the new cluster.
 */
@Override
public Configuration getConfiguration() {
  Policies policies = new Policies(
    loadBalancingPolicy == null ? Policies.defaultLoadBalancingPolicy() : loadBalancingPolicy,
    reconnectionPolicy == null ? Policies.defaultReconnectionPolicy() : reconnectionPolicy,
    retryPolicy == null ? Policies.defaultRetryPolicy() : retryPolicy,
    addressTranslater == null ? Policies.defaultAddressTranslater() : addressTranslater
  );
  return new Configuration(policies,
               new ProtocolOptions(port, protocolVersion, sslOptions, authProvider).setCompression(compression),
               poolingOptions == null ? new PoolingOptions() : poolingOptions,
               socketOptions == null ? new SocketOptions() : socketOptions,
               metricsEnabled ? new MetricsOptions(jmxEnabled) : null,
               queryOptions == null ? new QueryOptions() : queryOptions);
}

相关文章