@Test
  public void testMasterLockAcquireTimeout() throws Exception {
    LockManager.MasterLock lock =
      masterServices.getLockManager().createMasterLock(tableName, LockType.EXCLUSIVE, "desc");
    LockManager.MasterLock lock2 =
      masterServices.getLockManager().createMasterLock(tableName, LockType.EXCLUSIVE, "desc");
    assertTrue(lock.tryAcquire(2000));
    assertFalse(lock2.tryAcquire(LOCAL_LOCKS_TIMEOUT / 2)); // wait less than other lock's timeout
    assertEquals(null, lock2.getProc());
    lock.release();
    assertTrue(lock2.tryAcquire(2000));
    assertTrue(lock2.getProc().isLocked());
    lock2.release();
  }
Two locks try to acquire lock on same table, assert that later one times out.
hbase-server/src/test/java/org/apache/hadoop/hbase/master/locking/TestLockManager.java