gpt4 book ai didi

com.twitter.common.zookeeper.ZooKeeperClient.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 02:14:49 32 4
gpt4 key购买 nike

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

ZooKeeperClient.<init>介绍

[英]Creates an unconnected client that will lazily attempt to connect on the first call to #get. All successful connections will be authenticated with the given credentials.
[中]创建一个未连接的客户端,该客户端将在第一次调用#get时懒洋洋地尝试连接。所有成功的连接都将使用给定的凭据进行身份验证。

代码示例

代码示例来源:origin: pinterest/secor

public ZookeeperConnector(SecorConfig config) {
  mConfig = config;
  mZookeeperClient = new ZooKeeperClient(Amount.of(1, Time.DAYS), getZookeeperAddresses());
  mLocks = new HashMap<String, DistributedLock>();
}

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

public static DLZkServerSet of(URI uri,
                int zkSessionTimeoutMs) {
  // Create zookeeper and server set
  String zkPath = uri.getPath() + "/" + ZNODE_WRITE_PROXY;
  Iterable<InetSocketAddress> zkAddresses = getZkAddresses(uri);
  ZooKeeperClient zkClient =
      new ZooKeeperClient(Amount.of(zkSessionTimeoutMs, Time.MILLISECONDS), zkAddresses);
  ServerSet serverSet = ServerSets.create(zkClient, ZooDefs.Ids.OPEN_ACL_UNSAFE, zkPath);
  return new DLZkServerSet(zkClient, serverSet);
}

代码示例来源:origin: eirslett/thrift-zookeeper

private static ZooKeeperClient getZooKeeperClient() {
    if (zooKeeperClient == null) {
      zooKeeperClient = new ZooKeeperClient(sessionTimeout, nodes);
    }
    return zooKeeperClient;
  }
}

代码示例来源:origin: com.senseidb.zu/zu-core

/**
 * @param zookeeperAddrs zookeeper hosts
 * @param clusterId name of the cluster
 * @param timeout zookeeper timeout in seconds
 * @throws MonitorException
 */
public ZuCluster(Iterable<InetSocketAddress> zookeeperAddrs, String clusterId,
  int timeout) throws MonitorException{
 this(new ZooKeeperClient(Amount.of(timeout, Time.SECONDS), Credentials.NONE, zookeeperAddrs), clusterId);
}

代码示例来源:origin: com.twitter.common/zookeeper-testing

/**
 * Returns a new authenticated zookeeper client connected to the in-process zookeeper server with
 * a custom {@code sessionTimeout} and a custom {@code chrootPath}.
 */
public final ZooKeeperClient createClient(Amount<Integer, Time> sessionTimeout,
  Credentials credentials, Optional<String> chrootPath) {
 final ZooKeeperClient client = new ZooKeeperClient(sessionTimeout, credentials,
   chrootPath, Arrays.asList(InetSocketAddress.createUnresolved("127.0.0.1", port)));
 shutdownRegistry.addAction(new ExceptionalCommand<InterruptedException>() {
  @Override public void execute() {
   client.close();
  }
 });
 return client;
}

代码示例来源:origin: org.apache.distributedlog/distributedlog-client

public static DLZkServerSet of(URI uri,
                int zkSessionTimeoutMs) {
  // Create zookeeper and server set
  String zkPath = uri.getPath() + "/" + ZNODE_WRITE_PROXY;
  Iterable<InetSocketAddress> zkAddresses = getZkAddresses(uri);
  ZooKeeperClient zkClient =
      new ZooKeeperClient(Amount.of(zkSessionTimeoutMs, Time.MILLISECONDS), zkAddresses);
  ServerSet serverSet = ServerSets.create(zkClient, ZooDefs.Ids.OPEN_ACL_UNSAFE, zkPath);
  return new DLZkServerSet(zkClient, serverSet);
}

代码示例来源:origin: com.twitter/distributedlog-client

public static DLZkServerSet of(URI uri,
                int zkSessionTimeoutMs) {
  // Create zookeeper and server set
  String zkPath = uri.getPath() + "/" + ZNODE_WRITE_PROXY;
  Iterable<InetSocketAddress> zkAddresses = getZkAddresses(uri);
  ZooKeeperClient zkClient =
      new ZooKeeperClient(Amount.of(zkSessionTimeoutMs, Time.MILLISECONDS), zkAddresses);
  ServerSet serverSet = ServerSets.create(zkClient, ZooDefs.Ids.OPEN_ACL_UNSAFE, zkPath);
  return new DLZkServerSet(zkClient, serverSet);
}

代码示例来源:origin: com.twitter.common.zookeeper.guice/client

@Override
protected void configure() {
 Key<ZooKeeperClient> clientKey = keyFactory.create(ZooKeeperClient.class);
 if (config.inProcess) {
  requireBinding(ShutdownRegistry.class);
  // Bound privately to give the local provider access to configuration settings.
  bind(ClientConfig.class).toInstance(config);
  bind(clientKey).toProvider(LocalClientProvider.class).in(Singleton.class);
 } else {
  ZooKeeperClient client =
    new ZooKeeperClient(config.sessionTimeout, config.credentials, config.chrootPath, config.servers);
  bind(clientKey).toInstance(client);
 }
 expose(clientKey);
}

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