gpt4 book ai didi

com.dangdang.ddframe.job.reg.zookeeper.ZookeeperConfiguration.setDigest()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 04:59:31 27 4
gpt4 key购买 nike

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

ZookeeperConfiguration.setDigest介绍

暂无

代码示例

代码示例来源:origin: com.dangdang/elastic-job-lite-lifecycle

/**
   * 创建注册中心.
   *
   * @param connectString 注册中心连接字符串
   * @param namespace 注册中心命名空间
   * @param digest 注册中心凭证
   * @return 注册中心对象
   */
  public static CoordinatorRegistryCenter createCoordinatorRegistryCenter(final String connectString, final String namespace, final Optional<String> digest) {
    Hasher hasher =  Hashing.md5().newHasher().putString(connectString, Charsets.UTF_8).putString(namespace, Charsets.UTF_8);
    if (digest.isPresent()) {
      hasher.putString(digest.get(), Charsets.UTF_8);
    }
    HashCode hashCode = hasher.hash();
    CoordinatorRegistryCenter result = REG_CENTER_REGISTRY.get(hashCode);
    if (null != result) {
      return result;
    }
    ZookeeperConfiguration zkConfig = new ZookeeperConfiguration(connectString, namespace);
    if (digest.isPresent()) {
      zkConfig.setDigest(digest.get());
    }
    result = new ZookeeperRegistryCenter(zkConfig);
    result.init();
    REG_CENTER_REGISTRY.put(hashCode, result);
    return result;
  }
}

代码示例来源:origin: pcbest/elastic-job-lite-starter-master

/**
 * Reg center zookeeper registry center.
 *
 * @return the zookeeper registry center
 */
@Bean(initMethod = "init")
@ConditionalOnMissingBean
public ZookeeperRegistryCenter regCenter() {
  ZookeeperConfiguration zookeeperConfiguration = new ZookeeperConfiguration(regCenterProperties.getZkAddressList(), regCenterProperties.getNamespace());
  zookeeperConfiguration.setBaseSleepTimeMilliseconds(regCenterProperties.getBaseSleepTimeMilliseconds());
  zookeeperConfiguration.setConnectionTimeoutMilliseconds(regCenterProperties.getConnectionTimeoutMilliseconds());
  zookeeperConfiguration.setMaxSleepTimeMilliseconds(regCenterProperties.getMaxSleepTimeMilliseconds());
  zookeeperConfiguration.setSessionTimeoutMilliseconds(regCenterProperties.getSessionTimeoutMilliseconds());
  zookeeperConfiguration.setMaxRetries(regCenterProperties.getMaxRetries());
  zookeeperConfiguration.setDigest(regCenterProperties.getDigest());
  return new ZookeeperRegistryCenter(zookeeperConfiguration);
}

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