public static List<HostAndPort> parseLocators(String locatorsString, InetAddress bindAddress)
      throws MembershipConfigurationException {
    List<HostAndPort> result = new ArrayList<>(2);
    Set<InetSocketAddress> inetAddresses = new HashSet<>();
    final boolean isLoopback = ((bindAddress != null) && bindAddress.isLoopbackAddress());

    StringTokenizer parts = new StringTokenizer(locatorsString, ",");
    while (parts.hasMoreTokens()) {
      String str = parts.nextToken();

      HostAndPort hostAndPort = parseLocator(str);
      String host = hostAndPort.getHostName();
      final InetSocketAddress isa = new InetSocketAddress(host, hostAndPort.getPort());

      if (isLoopback) {
        final InetAddress locatorAddress = isa.getAddress();
        if (locatorAddress == null) {
          throw new MembershipConfigurationException("This process is attempting to use a locator" +
              " at an unknown address or FQDN: " + host);
        }

        if (!locatorAddress.isLoopbackAddress()) {
          throw new MembershipConfigurationException(
              "This process is attempting to join with a loopback address (" + bindAddress
                  + ") using a locator that does not have a local address (" + isa
                  + ").  On Unix this usually means that /etc/hosts is misconfigured.");
        }
      }
      if (!inetAddresses.contains(isa)) {
        inetAddresses.add(isa);
        result.add(hostAndPort);
      }
    }

    return result;
  }
parse locators & check that the resulting address is compatible with the given address

@param locatorsString a DistributionConfig "locators" string
@param bindAddress optional address to check for loopback compatibility
@return addresses of locators
geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/api/LocatorConfigurationParser.java