protected void addBadLocators(List<HostAndPort> newLocators, Set<HostAndPort> badLocators) {
    for (HostAndPort badLocator : badLocators) {
      boolean addIt = true;
      for (HostAndPort goodLocator : newLocators) {
        boolean isSameHost = badLocator.getHostName().equals(goodLocator.getHostName());
        if (isSameHost && badLocator.getPort() == goodLocator.getPort()) {
          // ip has been changed so don't add this in current
          // list
          addIt = false;
          break;

        }
      }
      if (addIt) {
        newLocators.add(badLocator);
      }
    }
  }
This method will add bad locator only when locator with hostname and port is not already in
list.
geode-core/src/main/java/org/apache/geode/cache/client/internal/AutoConnectionSourceImpl.java