private void doLock(Integer lock) {
      try {
        synchronized (sync) {
          latestRequest++;
          Integer requestId = latestRequest;
          operationsMap.put(requestId, lock);
          requests.add(requestId);
          sync.notify();
          long maxWait = System.currentTimeMillis() + 2000;
          while (!completedRequests.contains(requestId)) {
            long waitMillis = maxWait - System.currentTimeMillis();
            assertThat(waitMillis > 0).isTrue();
            sync.wait(waitMillis);
          }
          Throwable t = (Throwable) throwables.get(requestId);
          if (t != null) {
            throw new Error(t);
          }
        }
      } catch (Exception ex) {
        throw new Error(ex);
      }
    }
Assumes there is only one host, and invokes the given method in the first numVMs VMs that host
knows about.
geode-core/src/distributedTest/java/org/apache/geode/distributed/DistributedLockServiceDUnitTest.java