@Override
  public void stop() throws CqClosedException {
    synchronized (cqState) {
      if (isClosed()) {
        throw new CqClosedException(
            String.format("CQ is closed, CqName : %s", cqName));
      }

      if (!(isRunning())) {
        throw new IllegalStateException(
            String.format("CQ is not in running state, stop CQ does not apply, CqName : %s",
                cqName));
      }

      // Change state and stats on the client side
      cqState.setState(CqStateImpl.STOPPED);
      cqService.stats().incCqsStopped();
      cqService.stats().decCqsActive();
      if (logger.isDebugEnabled()) {
        logger.debug("Successfully stopped the CQ. {}", cqName);
      }
    }
  }
Stop or pause executing the query.
geode-cq/src/main/java/org/apache/geode/cache/query/cq/internal/ServerCQImpl.java