code: @Override
      public AuthConfigProvider getConfigProvider(String layer, String appContext, RegistrationListener listener) {
          CacheEntry<AuthConfigProvider, RegistrationContext, Collection<RegistrationListener>> entry = null;
          lock.lock();
          try {
              if (layer != null && appContext != null)
                  entry = cache.get(new RegistrationID(layer, appContext)); // rule (1)
              if (entry == null) {
                  if (appContext != null)
                      entry = cache.get(new RegistrationID(null, appContext)); // rule (2)
                  if (entry == null) {
                      if (layer != null)
                          entry = cache.get(new RegistrationID(layer, null)); // rule (3)
                      if (entry == null) {
                          entry = cache.get(new RegistrationID(null, null)); // rule (4)
                      }
                  }
              }
  
              if (listener != null && entry != null) {
                  entry.listeners.add(listener);
              }
          } finally {
              lock.unlock();
          }
          AuthConfigProvider provider = entry == null ? null : entry.provider;
          if (tc.isDebugEnabled())
              Tr.debug(tc, "getConfigProvider entry", entry);
          return provider;
      }
docs: /*
  Implements lookup algorithm following the precedence rules in JSR-196:
  
  All factories shall employ the following precedence rules to select the registered AuthConfigProvider that
  matches the layer and appContext arguments:
  
  (1) The provider that is specifically registered for both the corresponding message layer and appContext shall be selected.
  (2) If no provider is selected according to the preceding rule, the provider specifically registered for the corresponding
  appContext and for all message layers shall be selected.
  (3) If no provider is selected according to the preceding rules, the provider specifically registered for the corresponding
  message layer and for all appContexts shall be selected.
  (4) If no provider is selected according to the preceding rules, the provider registered for all message layers and for all
  appContexts shall be selected.
  (5) If no provider is selected according to the preceding rules, the factory shall terminate its search for a registered provider.
  
  The above precedence rules apply equivalently to registrations created with a null or non-null className argument.