public void stopCQ(VM vm, final String cqName) throws Exception {
    vm.invoke(new CacheSerializableRunnable("Stop CQ :" + cqName) {
      @Override
      public void run2() throws CacheException {
        LogWriterUtils.getLogWriter().info("### Stop CQ. ###" + cqName);
        // Get CQ Service.
        QueryService cqService = null;
        try {
          cqService = getCache().getQueryService();
        } catch (Exception cqe) {
          Assert.fail("Failed to getCQService.", cqe);
        }

        // Stop CQ.
        CqQuery cq1 = null;
        try {
          cq1 = cqService.getCq(cqName);
          cq1.stop();
        } catch (Exception ex) {
          Assert.fail("Failed to stop CQ " + cqName + " . ", ex);
        }
        assertTrue("Stop CQ state mismatch", cq1.getState().isStopped());
      }
    });
  }
Execute/register CQ as running.

@param initialResults true if initialResults are requested
@param expectedResultsSize if >= 0, validate results against this size
@param expectedErr if not null, an error we expect
geode-cq/src/distributedTest/java/org/apache/geode/cache/query/cq/dunit/CqQueryUsingPoolDUnitTest.java