gpt4 book ai didi

com.bazaarvoice.ostrich.discovery.zookeeper.ZooKeeperHostDiscovery.getHosts()方法的使用及代码示例

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

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

ZooKeeperHostDiscovery.getHosts介绍

暂无

代码示例

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

@Override
  public boolean isValid() {
    return Iterables.contains(_hostDiscovery.getHosts(), host);
  }
});

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

@Override
  public boolean isValid() {
    return Iterables.contains(_hostDiscovery.getHosts(), host);
  }
});

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

/**
 * Returns the current list of endPoints.  Unlike {@link #getEndPoints()} the host discovery is queried and a new
 * list of endPoints is generated on every call.
 */
private ImmutableList<EndPoint> getEndPointsFromHostDiscovery() {
  Iterable<ServiceEndPoint> hosts = _hostDiscovery.getHosts();
  ImmutableList.Builder<EndPoint> endPoints = ImmutableList.builder();
  for (final ServiceEndPoint host : hosts) {
    if (host.equals(_self)) {
      continue;
    }
    endPoints.add(new EndPoint() {
      @Override
      public String getAddress() {
        return _endPointAdapter.toEndPointAddress(host);
      }
      @Override
      public boolean isValid() {
        return Iterables.contains(_hostDiscovery.getHosts(), host);
      }
    });
  }
  return endPoints.build();
}

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

/**
 * Returns the current list of endPoints.  Unlike {@link #getEndPoints()} the host discovery is queried and a new
 * list of endPoints is generated on every call.
 */
private ImmutableList<EndPoint> getEndPointsFromHostDiscovery() {
  Iterable<ServiceEndPoint> hosts = _hostDiscovery.getHosts();
  ImmutableList.Builder<EndPoint> endPoints = ImmutableList.builder();
  for (final ServiceEndPoint host : hosts) {
    if (host.equals(_self)) {
      continue;
    }
    endPoints.add(new EndPoint() {
      @Override
      public String getAddress() {
        return _endPointAdapter.toEndPointAddress(host);
      }
      @Override
      public boolean isValid() {
        return Iterables.contains(_hostDiscovery.getHosts(), host);
      }
    });
  }
  return endPoints.build();
}

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

@Override
  protected void run(Bootstrap<EmoConfiguration> bootstrap, Namespace namespace, EmoConfiguration configuration)
      throws Exception {
    String serviceName = namespace.getString("service");

    CuratorFramework curator = configuration.getZooKeeperConfiguration().newCurator();
    curator.start();

    ZooKeeperHostDiscovery hostDiscovery = new ZooKeeperHostDiscovery(curator, serviceName, bootstrap.getMetricRegistry());

    for (ServiceEndPoint endPoint : hostDiscovery.getHosts()) {
      System.out.println(endPoint.getId());
    }

    hostDiscovery.close();
    curator.close();
  }
}

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