private void acquireLockInDifferentThread(final int num) throws InterruptedException {
    final CountDownLatch latch = new CountDownLatch(num);
    Thread thread = new Thread(() -> {
      CacheOperationFacade cacheFacade = new GeodeCacheFacade(cache);
      for (int i = 0; i < num; i++) {
        boolean result = cacheFacade.acquireAutoBalanceLock();
        if (result) {
          latch.countDown();
        }
      }
    });
    thread.start();
    assertTrue(latch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS));
  }
IntegrationTests for AutoBalancer that include usage of Cache, StatSampler and
DistributedLockService.
geode-rebalancer/src/integrationTest/java/org/apache/geode/cache/util/AutoBalancerIntegrationJUnitTest.java