public boolean unregister(Pool pool) {
    // Continue only if the pool is not currently being used by any region and/or service.
    int attachCount = 0;
    if (pool instanceof PoolImpl) {
      attachCount = ((PoolImpl) pool).getAttachCount();
    }
    if (attachCount > 0) {
      throw new IllegalStateException(String.format(
          "Pool could not be destroyed because it is still in use by %s regions", attachCount));
    }

    synchronized (poolLock) {
      Map<String, Pool> copy = new HashMap<>(pools);
      String name = pool.getName();
      // debugStack("unregister pool=" + name);
      Object rmPool = copy.remove(name);
      if (rmPool == null || rmPool != pool) {
        return false;
      } else {
        pools = Collections.unmodifiableMap(copy);
        itrForEmergencyClose = Optional.of(copy.values().iterator());
        return true;
      }
    }
  }
This is called by {@link Pool#destroy(boolean)}

@return true if pool unregistered from cache; false if someone else already did it
geode-core/src/main/java/org/apache/geode/internal/cache/PoolManagerImpl.java