public Set<DistributedMember> getAllMembers() {
    return ManagementUtils.getAllMembers(cache);
  }
Gets all members in the GemFire distributed system/cache, including locators

@return a set of all members
geode-gfsh/src/main/java/org/apache/geode/management/cli/GfshCommand.java