@Override
      public Object call() throws Exception {
        final DistributedRegion r = (DistributedRegion) getCache().getRegion(rName);
        final OffHeapMemoryMonitor ohmm =
            ((InternalResourceManager) getCache().getResourceManager()).getOffHeapMonitor();
        assertFalse(ohmm.getState().isCritical());

        int expectedInvocations = expected;
        {
          Integer k = 4;
          assertEquals(k.toString(), r.get(k, expectedInvocations++));
        }

        // Place in a critical state for the next test
        r.put("oh3", new byte[157287]);
        WaitCriterion wc = new WaitCriterion() {
          @Override
          public String description() {
            return "expected region " + r + " to set memoryThreshold";
          }

          @Override
          public boolean done() {
            return r.isMemoryThresholdReached();
          }
        };
        Wait.waitForCriterion(wc, 30 * 1000, 10, true);
        {
          Integer k = 5;
          assertEquals(k.toString(), r.get(k, expectedInvocations++));
        }

        r.destroy("oh3");
        wc = new WaitCriterion() {
          @Override
          public String description() {
            return "expected region " + r + " to unset memoryThreshold";
          }

          @Override
          public boolean done() {
            return !r.isMemoryThresholdReached();
          }
        };
        Wait.waitForCriterion(wc, 30 * 1000, 10, true);
        {
          Integer k = 6;
          assertEquals(k.toString(), r.get(k, expectedInvocations++));
        }
        return expectedInvocations;
      }
Test that DistributedRegion cacheLoade and netLoad are passed through to the calling thread if
the local VM is in a critical state. Once the VM has moved to a safe state then test that they
are allowed.
geode-core/src/distributedTest/java/org/apache/geode/cache/management/MemoryThresholdsOffHeapDUnitTest.java