code: private ReentrantLock optionallyObtainLockedLock(AuthenticationData authenticationData) {
          ReentrantLock currentLock = null;
          if (isAuthCacheServiceAvailable()) {
              currentLock = authenticationGuard.requestAccess(authenticationData);
              currentLock.lock();
          }
          return currentLock;
      }
docs: This method will try to obtain a lock from the authentication guard based on the
  given authentication data and lock it. If an equals authentication data on another thread
  is received for which a lock already exists, this method will block that another thread
  until the first thread relinquishes the lock. This allows having locking based on
  authentication data instead of blindly locking all access. The intention is to NOT allow
  multiple concurrent JAAS logins for the same authentication data in order to be able to
  correctly represent the user with the same runtime subject for the same data, better
  manage caching, and to prevent cycles doing logins for which potentially many of the
  results will be discarded.
  
  This method has no locking effect when there is no authentication cache.