private boolean shutdownInProgress() {
    InternalCache cache = cqService.getInternalCache();
    if (cache == null || cache.isClosed()) {
      return true; // bail, things are shutting down
    }

    String reason = cqProxy.getPool().getCancelCriterion().cancelInProgress();
    return reason != null;
  }
Check to see if shutdown in progress.

@return true if shutdown in progress else false.
geode-cq/src/main/java/org/apache/geode/cache/query/cq/internal/ClientCQImpl.java