docs: AcquireResult acquire(AcquireInvocationKey key, boolean wait) {
          SemaphoreEndpoint endpoint = key.endpoint();
          SessionSemaphoreState state = sessionStates.get(key.sessionId());
          if (state != null && state.containsInvocation(endpoint.threadId(), key.invocationUid())) {
              return new AcquireResult(key.permits(), Collections.<AcquireInvocationKey>emptyList());
          }
  
          Collection<AcquireInvocationKey> cancelled = cancelWaitKeys(endpoint, key.invocationUid());
  
          if (!isAvailable(key.permits())) {
              if (wait) {
                  addWaitKey(endpoint, key);
              }
  
              return new AcquireResult(0, cancelled);
          }
  
          assignPermitsToInvocation(endpoint, key.invocationUid(), key.permits());
  
          return new AcquireResult(key.permits(), cancelled);
      }