Enhanced ServiceLoader?

mark.reinhold at oracle.com mark.reinhold at oracle.com
Mon Mar 9 21:06:18 UTC 2015


2015/2/15 10:32 -0800, Tim Boudreau <niftiness at gmail.com>:
> mark.reinhold at oracle.com:
>> Well, at the very least it means, "enhanced so as to integrate it
>> with the module system so that service bindings can be based upon
>> the available modules rather than (or in addition to) whatever
>> META-INF/services files happen to be found on the class path."
>> 
>> The ordering of service providers is a tricky topic.
>> 
>> I agree with Peter when he says that explicit ordering requires a global
>> view of the run-time system.  That's not possible from the perspective of
>> a single module, which is why an @Ordered annotation makes no sense, but
>> sometimes you actually do have a global (or sufficiently-global) view.
> 
> Happy to hear that.  I agree, in principle, in a modular system, the pieces
> don't know about each other and so ordering seems at odds with the
> concept.  But reality is rarely so pure ...
> 
> ...
> 
> NetBeans did the ordering hints for years by enhancing META-INF/services
> files with magic comments, e.g.
> 
> #position 1000
> com.foo.Bar
> 
> It would be good if ServiceLoader could grow enough heft to handle that
> role - not necessarily identically - but the feature satisfies a proven
> need.

How is this any different than an @Ordered annotation?  Doesn't it still
assume that the author of a module somehow has global knowledge of how
that module will be used in every possible scenario?

- Mark


More information about the jpms-spec-experts mailing list