public void tryLock() {
    try {
      if (!lock.tryLock()) {
        failAlreadyInProgress(null);
      }
    } catch (OverlappingFileLockException e) {
      failAlreadyInProgress(e);
    }
  }
@Test
  public void tryLockConcurrently() {
    lock.tryLock();

    assertThatThrownBy(() -> lock.tryLock())
      .isInstanceOf(IllegalStateException.class)
      .hasMessage("Another SonarQube analysis is already in progress for this project");
  }