public static Set<DistributedMember> getAllMembers(InternalDistributedSystem internalDS) {
    return new HashSet<>(
        internalDS.getDistributionManager().getDistributionManagerIds());
  }
Returns a set of all the members of the distributed system including locators.
geode-core/src/main/java/org/apache/geode/management/internal/util/ManagementUtils.java