gpt4 book ai didi

com.twitter.distributedlog.ZooKeeperClientBuilder.retryPolicy()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 02:15:31 26 4
gpt4 key购买 nike

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

ZooKeeperClientBuilder.retryPolicy介绍

[英]Build zookeeper client with given retry policy retryPolicy.
[中]使用给定的重试策略retryPolicy构建zookeeper客户端。

代码示例

代码示例来源:origin: twitter/distributedlog

/**
 * Return a zookeeper client builder for testing.
 *
 * @return a zookeeper client builder
 */
public static ZooKeeperClientBuilder newBuilder() {
  return ZooKeeperClientBuilder.newBuilder()
      .retryPolicy(RetryPolicyUtils.DEFAULT_INFINITE_RETRY_POLICY)
      .connectionTimeoutMs(10000)
      .sessionTimeoutMs(60000)
      .zkAclId(null)
      .statsLogger(NullStatsLogger.INSTANCE);
}

代码示例来源:origin: twitter/distributedlog

.zkServers(zkServers)
.sessionTimeoutMs(conf.getZKSessionTimeoutMilliseconds())
.retryPolicy(retryPolicy)
.zkAclId(conf.getZkAclId())
.build();

代码示例来源:origin: twitter/distributedlog

/**
 * {@link https://issues.apache.org/jira/browse/DL-34}
 */
@DistributedLogAnnotations.FlakyTest
@Ignore
@Test(timeout = 60000)
public void testAclAuthSpansExpirationNonRetryableClient() throws Exception {
  ZooKeeperClient zkcAuth = clientBuilder().retryPolicy(null).zkAclId("test").build();
  zkcAuth.get().create("/test", new byte[0], DistributedLogConstants.EVERYONE_READ_CREATOR_ALL, CreateMode.PERSISTENT);
  CountDownLatch expired = awaitConnectionEvent(KeeperState.Expired, zkcAuth);
  CountDownLatch connected = awaitConnectionEvent(KeeperState.SyncConnected, zkcAuth);
  expireZooKeeperSession(zkcAuth.get(), 2000);
  expired.await(2, TimeUnit.SECONDS);
  connected.await(2, TimeUnit.SECONDS);
  zkcAuth.get().create("/test/key1", new byte[0], DistributedLogConstants.EVERYONE_READ_CREATOR_ALL, CreateMode.PERSISTENT);
  rmAll(zkcAuth, "/test");
}

代码示例来源:origin: twitter/distributedlog

.zkServers(zkServers)
.sessionTimeoutMs(conf.getZKSessionTimeoutMilliseconds())
.retryPolicy(retryPolicy)
.zkAclId(conf.getZkAclId())
.build();

代码示例来源:origin: twitter/distributedlog

private ZooKeeperClientBuilder clientBuilder(int sessionTimeoutMs)
    throws Exception {
  return ZooKeeperClientBuilder.newBuilder()
      .name("zkc")
      .uri(DLMTestUtil.createDLMURI(zkPort, "/"))
      .sessionTimeoutMs(sessionTimeoutMs)
      .zkServers(zkServers)
      .retryPolicy(new BoundExponentialBackoffRetryPolicy(100, 200, 2));
}

代码示例来源:origin: twitter/distributedlog

.zkAclId(conf.getZkAclId())
    .uri(uri)
    .retryPolicy(retryPolicy)
    .statsLogger(statsLogger.scope("dlzk_dlm_writer_shared"));
this.ownWriterZKC = true;
      .requestRateLimit(conf.getZKRequestRateLimit())
      .zkServers(zkServersForReader)
      .retryPolicy(retryPolicy)
      .zkAclId(conf.getZkAclId())
      .statsLogger(statsLogger.scope("dlzk_dlm_reader_shared"));

代码示例来源:origin: twitter/distributedlog

private static ZooKeeperClientBuilder createDLZKClientBuilder(String zkcName,
                              DistributedLogConfiguration conf,
                              String zkServers,
                              StatsLogger statsLogger) {
  RetryPolicy retryPolicy = null;
  if (conf.getZKNumRetries() > 0) {
    retryPolicy = new BoundExponentialBackoffRetryPolicy(
      conf.getZKRetryBackoffStartMillis(),
      conf.getZKRetryBackoffMaxMillis(), conf.getZKNumRetries());
  }
  ZooKeeperClientBuilder builder = ZooKeeperClientBuilder.newBuilder()
    .name(zkcName)
    .sessionTimeoutMs(conf.getZKSessionTimeoutMilliseconds())
    .retryThreadCount(conf.getZKClientNumberRetryThreads())
    .requestRateLimit(conf.getZKRequestRateLimit())
    .zkServers(zkServers)
    .retryPolicy(retryPolicy)
    .statsLogger(statsLogger)
    .zkAclId(conf.getZkAclId());
  LOG.info("Created shared zooKeeper client builder {}: zkServers = {}, numRetries = {}, sessionTimeout = {}, retryBackoff = {},"
       + " maxRetryBackoff = {}, zkAclId = {}.", new Object[] { zkcName, zkServers, conf.getZKNumRetries(),
      conf.getZKSessionTimeoutMilliseconds(), conf.getZKRetryBackoffStartMillis(),
      conf.getZKRetryBackoffMaxMillis(), conf.getZkAclId() });
  return builder;
}

代码示例来源:origin: twitter/distributedlog

private static ZooKeeperClientBuilder createBKZKClientBuilder(String zkcName,
                               DistributedLogConfiguration conf,
                               String zkServers,
                               StatsLogger statsLogger) {
  RetryPolicy retryPolicy = null;
  if (conf.getZKNumRetries() > 0) {
    retryPolicy = new BoundExponentialBackoffRetryPolicy(
        conf.getBKClientZKRetryBackoffStartMillis(),
        conf.getBKClientZKRetryBackoffMaxMillis(),
        conf.getBKClientZKNumRetries());
  }
  ZooKeeperClientBuilder builder = ZooKeeperClientBuilder.newBuilder()
      .name(zkcName)
      .sessionTimeoutMs(conf.getBKClientZKSessionTimeoutMilliSeconds())
      .retryThreadCount(conf.getZKClientNumberRetryThreads())
      .requestRateLimit(conf.getBKClientZKRequestRateLimit())
      .zkServers(zkServers)
      .retryPolicy(retryPolicy)
      .statsLogger(statsLogger)
      .zkAclId(conf.getZkAclId());
  LOG.info("Created shared zooKeeper client builder {}: zkServers = {}, numRetries = {}, sessionTimeout = {}, retryBackoff = {},"
      + " maxRetryBackoff = {}, zkAclId = {}.", new Object[] { zkcName, zkServers, conf.getBKClientZKNumRetries(),
      conf.getBKClientZKSessionTimeoutMilliSeconds(), conf.getBKClientZKRetryBackoffStartMillis(),
      conf.getBKClientZKRetryBackoffMaxMillis(), conf.getZkAclId() });
  return builder;
}

代码示例来源:origin: twitter/distributedlog

/**
   * Create a zookeeper client builder with provided <i>conf</i> for testing.
   *
   * @param conf distributedlog configuration
   * @return zookeeper client builder
   */
  public static ZooKeeperClientBuilder newBuilder(DistributedLogConfiguration conf) {
    return ZooKeeperClientBuilder.newBuilder()
        .retryPolicy(RetryPolicyUtils.DEFAULT_INFINITE_RETRY_POLICY)
        .sessionTimeoutMs(conf.getZKSessionTimeoutMilliseconds())
        .zkAclId(conf.getZkAclId())
        .retryThreadCount(conf.getZKClientNumberRetryThreads())
        .requestRateLimit(conf.getZKRequestRateLimit())
        .statsLogger(NullStatsLogger.INSTANCE);
  }
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com