geode-wan/src/test/java/org/apache/geode/internal/cache/wan/WANTestBase.java
public static void validateRegionSizeRemainsSame(String regionName, final int regionSizeLimit) {
    final Region r = cache.getRegion(Region.SEPARATOR + regionName);
    assertNotNull(r);
    WaitCriterion wc = new WaitCriterion() {
      final int MIN_VERIFICATION_RUNS = 20;
      int sameRegionSizeCounter = 0;
      long previousSize = -1;

      public boolean done() {
        if (r.keySet().size() == previousSize) {
          sameRegionSizeCounter++;
          int s = r.keySet().size();
          // if the sameRegionSizeCounter exceeds the minimum verification runs and regionSize is
          // below specified limit, then return true
          if (sameRegionSizeCounter >= MIN_VERIFICATION_RUNS && s <= regionSizeLimit) {
            return true;
          } else {
            return false;
          }

        } else { // current regionSize is not same as recorded previous regionSize
          previousSize = r.keySet().size(); // update the previousSize variable with current region
                                            // size
          sameRegionSizeCounter = 0;// reset the sameRegionSizeCounter
          return false;
        }
      }

      public String description() {
        return "Expected region size to remain same below a specified limit but actual region size does not remain same or exceeded the specified limit "
            + sameRegionSizeCounter + " :regionSize " + previousSize;
      }
    };
    Wait.waitForCriterion(wc, 200000, 500, true);
  }
/**
   * This method is specifically written for pause and stop operations. This method validates that
   * the region size remains same for at least minimum number of verification attempts and also it
   * remains below a specified limit value. This validation will suffice for testing of pause/stop
   * operations.
   *
   * @param regionName
   * @param regionSizeLimit
   */
This method is specifically written for pause and stop operations. This method validates that
the region size remains same for at least minimum number of verification attempts and also it
remains below a specified limit value. This validation will suffice for testing of pause/stop
operations.

@param regionName
@param regionSizeLimit
This method is specifically written for pause and stop operations . This method validates that the region size remains same for at least minimum number of verification attempts and also it remains below a specified limit value . This validation will suffice for testing of pause / stop operations . @param regionName @param regionSizeLimit
public static void validateRegionSizeRemainsSame(String regionName, final int regionSizeLimit) {
    final Region r = cache.getRegion(Region.SEPARATOR + regionName);
    assertNotNull(r);
    WaitCriterion wc = new WaitCriterion() {
      final int MIN_VERIFICATION_RUNS = 20;
      int sameRegionSizeCounter = 0;
      long previousSize = -1;
      public boolean done() {
        if (r.keySet().size() == previousSize) {
          sameRegionSizeCounter++;
          int s = r.keySet().size();
          if (sameRegionSizeCounter >= MIN_VERIFICATION_RUNS && s <= regionSizeLimit) {
            return true;
          } else {
            return false;
          }
        } else { 
          previousSize = r.keySet().size(); 
          sameRegionSizeCounter = 0;
          return false;
        }
      }
      public String description() {
        return "Expected region size to remain same below a specified limit but actual region size does not remain same or exceeded the specified limit "
            + sameRegionSizeCounter + " :regionSize " + previousSize;
      }
    };
    Wait.waitForCriterion(wc, 200000, 500, true);
  }
public static void validateRegionSizeRemainsSame ( String regionName , final int regionSizeLimit ) { final Region r = cache . getRegion ( Region . SEPARATOR + regionName ) ; assertNotNull ( r ) ; WaitCriterion wc = new WaitCriterion ( ) { final int MIN_VERIFICATION_RUNS = 20 ; int sameRegionSizeCounter = 0 ; long previousSize = - 1 ; public boolean done ( ) { if ( r . keySet ( ) . size ( ) == previousSize ) { sameRegionSizeCounter ++ ; int s = r . keySet ( ) . size ( ) ; if ( sameRegionSizeCounter >= MIN_VERIFICATION_RUNS && s <= regionSizeLimit ) { return true ; } else { return false ; } } else { previousSize = r . keySet ( ) . size ( ) ; sameRegionSizeCounter = 0 ; return false ; } } public String description ( ) { return "Expected region size to remain same below a specified limit but actual region size does not remain same or exceeded the specified limit " + sameRegionSizeCounter + " :regionSize " + previousSize ; } } ; Wait . waitForCriterion ( wc , 200000 , 500 , true ) ; }
This method is specifically written for pause and stop operations.
This method is specifically written for pause and stop operations .
// if the sameRegionSizeCounter exceeds the minimum verification runs and regionSize is // below specified limit, then return true // current regionSize is not same as recorded previous regionSize // update the previousSize variable with current region // size // reset the sameRegionSizeCounter