public LockResource lockExclusive(StateLockOptions lockOptions)
      throws TimeoutException, InterruptedException, IOException {
    return lockExclusive(lockOptions, null);
  }
@Test
  public void testGraceMode_Forced() throws Throwable {
    // Enable interrupt-cycle with 100ms interval.
    configureInterruptCycle(true, 100);
    // The state-lock instance.
    StateLockManager stateLockManager = new StateLockManager();
    // Start a thread that owns the state-lock in shared mode.
    StateLockingThread sharedHolderThread = new StateLockingThread(stateLockManager, false);
    sharedHolderThread.start();
    sharedHolderThread.waitUntilStateLockAcquired();
    // Take the state-lock exclusively with GUARANTEED grace mode.
    try (LockResource lr = stateLockManager
        .lockExclusive(new StateLockOptions(GraceMode.FORCED, 10, 0, 100))) {
      // Holder should have been interrupted.
      Assert.assertTrue(sharedHolderThread.lockInterrupted());
      sharedHolderThread.join();
      // Spawn a new thread that waits on the lock.
      StateLockingThread sharedWaiterThread = new StateLockingThread(stateLockManager, false);
      sharedWaiterThread.start();
      // Wait until it's interrupted by the cycle too.
      CommonUtils.waitFor("waiter interrupted", () -> sharedWaiterThread.lockInterrupted());
      sharedWaiterThread.join();
    }
  }