runtime changes for services
Alan Bateman
Alan.Bateman at oracle.com
Thu Feb 16 02:21:35 PST 2012
On 16/02/2012 06:10, David Holmes wrote:
> On 16/02/2012 3:52 PM, Mandy Chung wrote:
>> On 2/15/2012 9:42 PM, David Holmes wrote:
>>>>
>>>> If there are 3 different modules PS1, PS2, PS3 providing the
>>>> implementation of service S, it'd be like:
>>>> module M {
>>>> requires PS1;
>>>> requires PS2;
>>>> requires PS3;
>>>> }
>>>
>>> Do you mean that PS1, PS2 and PS3 all combine to provide service S? Or
>>> that they each provide service S?
>>
>> The latter.
>
> Then in that case don't you want those requires clauses to be a
> disjunction rather than a conjunction? Else it appears M requires all
> three implementations of service S.
In this first version then "requires service S" is essentially treated
by the resolver as:
requires optional S1;
requires optional S2;
requires optional S3;
where at least one version of S1, S2, and S3 provide one or more
implementation of S.
It's done this way for now solely for performance reasons. I've gone
through several iterations where providing the service was an additional
constraint but the performance wasn't satisfactory. It needs further
work and I think should be done in conjunction with more extensive work
on the resolver.
The reason it's optional is because there may not be a version of S1
that can be used (because of "permits" or because of other constraints
that involve module that provide implementations of service types).
Anyway, to your question, it may be that only a version of S2 and S3 are
chosen and the implementations of S that they provide will be returned
by the ServiceLoader's iterator.
-Alan.
More information about the jigsaw-dev
mailing list