Enhanced ServiceLoader?

mark.reinhold at oracle.com mark.reinhold at oracle.com
Mon Feb 16 01:26:31 UTC 2015


2015/2/11 7:05 -0800, Tim Boudreau <niftiness at gmail.com>:
> *Binding — The Java run-time system must bind service implementations to
> interfaces and make these bindings available via an enhanced version of the
> existing java.util.ServiceLoader API.*
> 
> Are there any specifics as to what is meant by "enhanced" here?

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.

When assembling an entire standalone application, e.g., it could well
make sense, as I think David was trying to suggest, to allow an order to
be specified when linking the application together.

It could also make sense to allow a sophisticated application that's
managing modules on its own, via dynamic configurations, to specify an
order in the context of a particular configuration.  That way an app
server could, e.g., control which providers are seen, and in what order,
by the web apps that it hosts.

In any case, I think this is a somewhat detailed (and, also, somewhat
orthogonal) design issue which we can tackle later on, unless someone
thinks it's critical to mention it in the requirements.

- Mark


More information about the jpms-spec-observers mailing list