What is the module scope of Service Loader?
Peter Kriens
peter.kriens at aqute.biz
Mon Oct 12 15:11:35 UTC 2015
Yo use the ‘application module path’ in your answers. I could not find a definition of this in the SOTM nor the API? What happens to getDrivers when there are multiple paths, assuming this is possible? Do I see the drivers of the other path?
Thanks, kind regards,
Peter Kriens
> On 5 okt. 2015, at 20:58, mark.reinhold at oracle.com wrote:
>
> 2015/9/28 10:01 -0700, peter.kriens at aqute.biz:
>> It is not clear to me from the description how Service Loader finds
>> implementation classes. For example DriverManager.getDrivers() returns
>> a list of all _installed_ drivers. It is not clear to me from which
>> modules these drivers are loaded.
>>
>> * Is this system wide?
>> * Just the modules the caller can read?
>> * The modules the java.sql module can read?
>
> No to all three. Readability does not affect service-provider lookup.
>
> The existing class-loader-based methods in ServiceLoader will continue to
> work as before: They will search for providers known to the given (or
> implied) class loader, and then its parent, etc., regardless of which
> modules they're in. An existing method such as DriverManager::getDrivers
> will work as before, except that it will be able to locate providers on
> the application module path as well as on the class path.
>
> - Mark
More information about the jpms-spec-observers
mailing list