code: private long getWriteLockWithOptionalWait(final long timeout, final TimeUnit unit)
              throws InterruptedException {
          // Get the write lock and capture start time and max wait time if waiting a specified
          // timeout
          final long start;
          if (timeout >= 0) {
              start = System.currentTimeMillis();
  
              final boolean locked = this.writeLock.tryLock(timeout, unit);
              if (!locked) {
                  // Hit timeout waiting for lock
                  return Long.MIN_VALUE;
              }
          } else {
              start = -1;
  
              this.writeLock.lock();
          }
          return start;
      }
docs: Acquires a write lock either using {@link Lock#tryLock(long, TimeUnit)} if timeout >= 0 or
  using {@link Lock#lock()} if timeout < 0.
  
  @param timeout Duration to wait for lock, if less than 0 will wait forever via {@link
  Lock#lock()}
  @param unit Time units for timeout
  @return If waiting with timeout the {@link System#currentTimeMillis()} that the waiting
  started, if waiting with timeout timed out will return {@value Long#MIN_VALUE}
  @throws InterruptedException