private void executeQueryMultipleTimes(String queryStr, boolean useBindParam) throws Exception {
    QueryService qs = CacheUtils.getCache().getQueryService();
    Region region = CacheUtils.getCache().getRegion("pos");

    Query q = qs.newQuery(queryStr);
    SelectResults results;
    SelectResults expectedResults;

    if (useBindParam) {
      results = (SelectResults) q.execute(new Object[] {"in%ve", "X%X"});
    } else {
      results = (SelectResults) q.execute();
    }

    // Execute the query again to verify if it is still using the index
    if (useBindParam) {
      results = (SelectResults) q.execute(new Object[] {"in%ve", "X%X"});
    } else {
      results = (SelectResults) q.execute();
    }
  }
Test to verify that query executes using index even when the index is being removed during the
execution
geode-core/src/integrationTest/java/org/apache/geode/cache/query/functional/LikePredicateJUnitTest.java