@Override
      public void run2() throws CacheException {
        LogWriterUtils.getLogWriter().info("### Close All CQ 2. ###");
        // Get CQ Service.
        QueryService cqService = null;
        try {
          cqService = getCache().getQueryService();
        } catch (Exception cqe) {
          Assert.fail("Failed to getCQService.", cqe);
        }

        // Close CQ.
        try {
          cqService.closeCqs();
        } catch (Exception ex) {
          Assert.fail("Failed to close All CQ  . ", ex);
        }
      }
Test for CQ register and UnRegister.
geode-cq/src/distributedTest/java/org/apache/geode/cache/query/cq/dunit/CqQueryUsingPoolDUnitTest.java