@Test
  public void testPutGetTimeout() {
    assertThat(Scope.GLOBAL).isEqualTo(getRegionAttributes().getScope());

    final String name = getUniqueName();
    final Object key = "KEY";
    final Object value = "VALUE";

    vm0.invoke("Create Region", () -> {
      createRegion(name);
    });

    vm1.invoke("Create Region", () -> {
      createRegion(name);
    });

    vm0.invoke("Lock entry", () -> {
      Region region = getRootRegion().getSubregion(name);
      Lock lock = region.getDistributedLock(key);
      lock.lock();
    });

    vm1.invoke("Attempt get/put", () -> {
      Cache cache = getCache();
      cache.setLockTimeout(1);
      cache.setSearchTimeout(1);
      Region<Object, Object> region = getRootRegion().getSubregion(name);

      try {
        region.put(key, value);
        fail("Should have thrown a TimeoutException on put");

      } catch (TimeoutException ex) {
        // pass..
      }

      // With a loader, should try to lock and time out
      region.getAttributesMutator().setCacheLoader(new TestCacheLoader<Object, Object>() {
        @Override
        public Object load2(LoaderHelper helper) {
          return null;
        }
      });
      try {
        region.get(key);
        fail("Should have thrown a TimeoutException on get");

      } catch (TimeoutException ex) {
        // pass..
      }

      // Without a loader, should succeed
      region.getAttributesMutator().setCacheLoader(null);
      region.get(key);
    });

    vm0.invoke("Unlock entry", () -> {
      Region region = getRootRegion().getSubregion(name);
      Lock lock = region.getDistributedLock(key);
      lock.unlock();
    });
  }
Tests that {@link Region#put} and {@link Region#get} timeout when another VM holds the
distributed lock on the entry in question.
geode-core/src/distributedTest/java/org/apache/geode/cache30/GlobalRegionDUnitTest.java