Exemplo n.º 1
0
 public List<InstanceLocationSpecifier> getAliveInstances(ILocationSpecifier loc) {
   return TopologyManager.getInstance()
       .getSubInstances(loc)
       .stream()
       .filter(item -> isAlive(item))
       .collect(Collectors.toList());
 }
Exemplo n.º 2
0
  private InstanceLocationSpecifier getInstanceLocationSpecifier(int ip) {
    List<InstanceLocationSpecifier> locs =
        TopologyManager.getInstance()
            .getAllEndpoints()
            .stream()
            .filter(loc -> loc.getIp() == ip)
            .collect(Collectors.toList());
    if (locs.isEmpty()) {
      LOG.warning("InstanceLocationSpecifier wasn't found for ip=" + ip);
      return new InstanceLocationSpecifier(ip + "", ip);
    }

    if (locs.size() > 1) {
      LOG.warning("Found more than a single InstanceLocationSpecifier for ip=" + ip);
    }

    return locs.get(0);
  }
Exemplo n.º 3
0
 public List<InstanceLocationSpecifier> getAliveInstances() {
   return getAliveInstances(TopologyManager.getInstance().getSegment());
 }