On 14/08/2014 01:34, Wang Weijun wrote:
Yes, I see a lot of places using

    if (loadProviderFromProperty())
        return provider;
    if (loadProviderAsService())
        return provider;

The 1st using Class.forName() and 2nd ServiceLoader.load().

I was thinking that the 1st method will not work because Class.forName() on an 
internal class in another module will not work after module, but now I believe 
the 2nd method would not work also. Is that right?
It would be a bug if ServiceLoader didn't work with modules.

Or writing the class name in a services file automatically exports it as a 
service?

Now my preferred order will be

    if (loadProviderFromProperty())
        return provider;
    if (loadProviderAsInstalledService())
        return provider;
    if (loadProviderAsService())
        return provider;

Looking at JDK-8038089 again then I'm not sure why loadProviderFromProperty is here. If you are limiting this to just implementations of the Kerberos cipher suites and you only want to use service providers that are in the JDK image then ServiceLoader.loadInstalled should be sufficient.

-Alan

Reply via email to