On Mon, 4 Oct 2021 13:59:43 GMT, Weijun Wang <wei...@openjdk.org> wrote:

>> This fix adds a cache of service provider classes to LoginContext (in 
>> particular, it's a cache of LoginModules classes). The approach helps to 
>> increase the performance of the LoginContext.login() method significantly, 
>> especially in a multi-threading environment. Service Loader is used for 
>> polling on Service Provider classes, without instantiating LoginModules 
>> object if Service Provider name doesn't match record in .config file. The 
>> set of service providers is cached for each Context Loader separately.
>> This code passed successfully tier1 and tier2 tests on mac os.
>
> src/java.base/share/classes/javax/security/auth/login/LoginContext.java line 
> 306:
> 
>> 304:                                 () -> java.util.ServiceLoader.load(
>> 305:                                     LoginModule.class, 
>> contextClassLoader));
>> 306:                 Set<Provider<LoginModule>> lmProviders = 
>> sc.stream().collect(Collectors.toSet());
> 
> It's probably necessary to put the `collect` call above inside doPriv as 
> well. The actual class loading might happen later.

I'm seeing a JCK failure on this change. Will investigate more. At the same 
time, is it possible to merge this synchronized block into the one below?

-------------

PR: https://git.openjdk.java.net/jdk/pull/5748

Reply via email to