/**
  * Hydra task to verify queries on the region after all ops. This MUST be called as a batched
  * task, and will throw StopSchedulingTaskOnClientOrder when completed. It is necessary to
  * reinitialize the verify state variables if this is called a second time in this VM, however an
  * error is thrown if a second attempt it made without resetting the state variables.
  */
 public static void HydraTask_verifyQueries() {
   if (CQsOn) {
     // the region contents verify task comes first, so if we got to this
     // task, then we know the the region is a perfect snapshot of what
     // we expect; the CQTestInstance relies on a snapshot
     if (verifyQueryIterator == null) {
       testInstance.CQTestInstance.regionSnapshot = new HashMap(testInstance.aRegion);
       verifyQueryIterator = testInstance.queryMap.keySet().iterator();
     }
     if (verifyQueryIterator.hasNext()) {
       verifyQueryCount++;
       String cqName = (String) (verifyQueryIterator.next());
       Log.getLogWriter()
           .info(
               "Verifying query "
                   + verifyQueryCount
                   + " out of "
                   + testInstance.queryMap.size()
                   + " with name "
                   + cqName);
       testInstance.CQTestInstance.verifyQuery(cqName);
     } else {
       String aStr = "Done verifying " + verifyQueryCount + " queries";
       Log.getLogWriter().info(aStr);
       // set for next time; if this is an init task, then we will be set for the close task
       verifyQueryIterator = null;
       verifyQueryCount = 0;
       throw new StopSchedulingTaskOnClientOrder(aStr);
     }
   } else {
     String aStr = "Skipping verification of queries because CQUtilPrms.CQsOn is " + CQsOn;
     Log.getLogWriter().info(aStr);
     throw new StopSchedulingTaskOnClientOrder(aStr);
   }
 }
 /**
  * Initialize a client vm.
  *
  * @param startCQsRunning true if the initialize should start the CQs running false otherwise
  */
 private void initializeClient(boolean startCQsRunning) {
   initializeRegion("clientRegion");
   initializeInstance();
   if (isBridgeConfiguration) {
     isBridgeClient = true;
     registerInterest(testInstance.aRegion);
     if (CQsOn) {
       CQTestInstance.initializeQueryService();
       queryMap = testInstance.CQTestInstance.generateQueries(queryDepth);
       CQTestInstance.queryMap = queryMap;
       CQTestInstance.aRegion = aRegion;
       if (startCQsRunning) {
         CQTestInstance.initializeCQs();
       }
     } else {
       Log.getLogWriter().info("Not creating CQs because CQUtilPrms.CQsOn is " + CQsOn);
     }
   }
 }