@Test
  public void testConcurrentPutsNotExceedingLimit() throws Exception {
    exceptionOccurred = false;
    quitForLoop = false;
    List<Thread> listOfThreads = new ArrayList<>();
    HARegionQueueAttributes harqa = new HARegionQueueAttributes();
    harqa.setBlockingQueueCapacity(10000);
    final HARegionQueue hrq = getHARegionQueueInstance(
        "BlockingHARegionJUnitTest_Region", cache, harqa, BLOCKING_HA_QUEUE, false,
        disabledClock());
    hrq.setPrimary(true);// fix for 40314 - capacity constraint is checked for primary only.
    listOfThreads.add(new DoPuts(hrq, 20000, 1));
    listOfThreads.add(new DoPuts(hrq, 20000, 2));
    listOfThreads.add(new DoPuts(hrq, 20000, 3));
    listOfThreads.add(new DoPuts(hrq, 20000, 4));
    listOfThreads.add(new DoPuts(hrq, 20000, 5));

    for (Thread thread : listOfThreads) {
      thread.start();
    }

    GeodeAwaitility.await().until(() -> hrq.region.size() == 20000);

    for (Thread thread : listOfThreads) {
      assertThat(thread.isAlive()).isTrue();
    }

    assertThat(hrq.region.size()).isEqualTo(20000);

    quitForLoop = true;

    for (Thread thread : listOfThreads) {
      thread.interrupt();
    }

    sleep(2000);

    for (Thread thread : listOfThreads) {
      join(thread, 10 * 60 * 1000);
    }

    cache.close();
  }
This test tests that the region capacity is never exceeded even in highly concurrent
environments. The region capacity is set to 10000. Then 5 threads start doing put
simultaneously. They will reach a state where the queue is full and they will all go in a wait
state. the region size would be verified to be 20000 (10000 puts and 10000 DACE objects). then
the threads are interrupted and made to quit the loop
geode-core/src/integrationTest/java/org/apache/geode/internal/cache/ha/BlockingHARegionJUnitTest.java