@Override
  public int getCount() {
    InternalDistributedSystem sys = InternalDistributedSystem.getAnyInstance();
    if (sys == null) {
      throw new IllegalStateException(
          "getCount requires a connection to the distributed system.");
    }
    DistributionManager dm = sys.getDistributionManager();
    return dm.getRoleCount(this);
  }
Factory method to allow canonicalization of instances. Returns existing instance or creates a
new instance.
geode-core/src/main/java/org/apache/geode/distributed/internal/membership/InternalRole.java