docs: public synchronized boolean lock(ActivityLog log, long maxWait, TimeUnit unit) throws Exception
      {
          if ( ownsTheLock )
          {
              throw new IllegalStateException("Already locked");
          }
  
          lockStartMs = System.currentTimeMillis();
  
          key = lockPrefix + lockKeySeparator + newRandomSequence();
  
          long        startMs = System.currentTimeMillis();
          boolean     hasMaxWait = (unit != null);
          long        maxWaitMs = hasMaxWait ? TimeUnit.MILLISECONDS.convert(maxWait, unit) : Long.MAX_VALUE;
          Preconditions.checkState(maxWaitMs >= settlingMs, String.format("The maxWait ms (%d) is less than the settling ms (%d)", maxWaitMs, settlingMs));
  
          createFile(key, content.getBytes());
  
          for(;;)
          {
              checkUpdate();
              if ( ownsTheLock )
              {
                  break;
              }
              long        thisWaitMs;
              if ( hasMaxWait )
              {
                  long        elapsedMs = System.currentTimeMillis() - startMs;
                  thisWaitMs = maxWaitMs - elapsedMs;
                  if ( thisWaitMs <= 0 )
                  {
                      log.add(ActivityLog.Type.ERROR, String.format("Could not acquire lock within %d ms, polling: %d ms, key: %s", maxWaitMs, pollingMs, key));
                      break;
                  }
              }
              else
              {
                  thisWaitMs = pollingMs;
              }
              wait(Math.min(pollingMs, thisWaitMs));
          }
          return ownsTheLock;
      }