code: private UserRegistry determineActiveUserRegistry(boolean exceptionOnError) throws RegistryException {
          synchronized (userRegistrySync) {
              UserRegistry ur = userRegistry.get();
              if (ur == null) {
                  if (isConfigured()) {
                      ur = getUserRegistryFromConfiguration();
                  } else {
                      ur = autoDetectUserRegistry(exceptionOnError);
                  }
  
                  // remember the user registry to use
                  userRegistry.set(ur);
              }
              return ur;
          }
      }
docs: Determines which UserRegistryFactory (possibly multiple)
  to load based on the configured refId(s). If the refId is undefined,
  a RegistryException is thrown. If there are multiple refIds specified,
  then they will be delegated to via the UserRegistryProxy. Otherwise,
  the single, requested UserRegistryFactory is found and its associated
  UserRegistry instance is returned.
  
  @return UserRegistry instance. {@code null} is not returned.
  @throws RegistryException if there is a problem obtaining the UserRegistry instance.