public boolean checkCacheClosing(ClusterDistributionManager dm) {
    if (dm == null) {
      return true;
    }
    InternalCache cache = dm.getCache();
    return cache == null || cache.isClosed();
  }
check to see if the cache is closing
geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessage.java