services, take 1
Julien Ponge
julien.ponge at gmail.com
Mon Dec 19 02:41:32 PST 2011
Hi Alan,
I have a few questions, but please keep in mind that I have only recently started looking at Jigsaw, and that I may have things wrong there and there. My questions may actually be more general than your initial email… :-)
> One of the areas that I've started to look into is how services might be
> implemented at installation and runtime. Note that I'm not talking about
> dynamic services and registration but rather a simple means to install
> service providers as modules so that they can be found at runtime via
> the ServiceLoader API. As the subject line suggests, I'm sure that we
> will go through several iterations on this topic.
>
>
>
Ok so my understanding is that Jigsaw at the moment (aka still an exploratory prototype) is a static modules system where modules have dependencies (names + versions). Some may also be optional. You can also now specify services exports / imports as well. Services get discovered through the the ServiceLoader facility, which is a good thing IMHO.
> 2. The changes to the linker are also very simple. Contexts that provide
> a service becomes service suppliers to modules that require the service.
> The set of service suppliers is separate to the supplying contexts (for
> visibility reasons). The additional maps are stored in the configuration
> to make them available at runtime. There will be a few other changes
> needed here once we get back to the run-time modulepath support.
>
>
>
Something which is not clear by looking at the scarce documentation and (empty) javadocs is how modules affect classloading. Do modules form an directed graph of classloaders underneath? Or do modules resolve within their client context classloaders?
> 3. ServiceLoader is updated so that when we are in module mode it goes
> to the module class loader to get the service implementation classes
> that are in both the local and remote contexts supplying services. In
> legacy mode, or where class loaders other than module class loaders are
> used, then it continues to look for service configuration files.
>
>
>
Suppose that I have a module that does a lookup on all services implementing ServiceA.
1. How do you load another module at runtime?
2. Do you see new services via the ServiceLoader?
I think a dynamic modules/services API is important to have, not necessarily as an OSGi clone either. My fear is that otherwise people will build such frameworks on top of Jigsaw because there is a need for it in app servers and such, so I'd better have a clean/simple API in Jigsaw.
Cheers
>
--
Julien Ponge
http://julien.ponge.info/
More information about the jigsaw-dev
mailing list