@Override
  public void setCqState(int state) {
    if (isClosed()) {
      throw new CqClosedException(
          String.format("CQ is closed, CqName : %s", cqName));
    }

    synchronized (cqState) {
      if (state == CqStateImpl.RUNNING) {
        cqState.setState(CqStateImpl.RUNNING);
        cqService.stats().incCqsActive();
        cqService.stats().decCqsStopped();
      } else if (state == CqStateImpl.STOPPED) {
        cqState.setState(CqStateImpl.STOPPED);
        cqService.stats().incCqsStopped();
        cqService.stats().decCqsActive();
      } else if (state == CqStateImpl.CLOSING) {
        cqState.setState(state);
      }
    }
  }
Return the state of this query. Should not modify this state without first locking it.

@return STOPPED RUNNING or CLOSED
geode-cq/src/main/java/org/apache/geode/cache/query/cq/internal/CqQueryImpl.java