@Override
      public void run2() throws CacheException {
        CqQuery cq1 = null;
        LogWriterUtils.getLogWriter().info("### Stop and Exec CQ. ###" + cqName);
        // Get CQ Service.
        QueryService cqService = null;
        try {
          cqService = getCache().getQueryService();
        } catch (Exception cqe) {
          Assert.fail("Failed to getCqService.", cqe);
        }

        // Get CQ.
        try {
          cq1 = cqService.getCq(cqName);
        } catch (Exception ex) {
          Assert.fail("Failed to get CQ " + cqName + " . ", ex);
        }

        for (int i = 0; i < count; ++i) {
          // Stop CQ.
          try {
            cq1.stop();
          } catch (Exception ex) {
            Assert.fail("Count = " + i + "Failed to stop CQ " + cqName + " . ", ex);
          }
          assertTrue("Stop CQ state mismatch, count = " + i, cq1.getState().isStopped());
          LogWriterUtils.getLogWriter()
              .info("After stop in Stop and Execute loop, ran successfully, loop count: " + i);
          LogWriterUtils.getLogWriter().info("CQ state: " + cq1.getState());

          // Re-execute CQ
          try {
            cq1.execute();
          } catch (Exception ex) {
            Assert.fail("Count = " + i + "Failed to execute CQ " + cqName + " . ", ex);
          }
          assertTrue("Execute CQ state mismatch, count = " + i, cq1.getState().isRunning());
          LogWriterUtils.getLogWriter()
              .info("After execute in Stop and Execute loop, ran successfully, loop count: " + i);
          LogWriterUtils.getLogWriter().info("CQ state: " + cq1.getState());
        }
      }
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