Extending java.base module

Langer, Christoph christoph.langer at sap.com
Wed Feb 15 13:21:38 UTC 2017


thanks all for your very helpful comments.

So I see that I cannot rely on my Service implementation at an early stage. But I can imagine that I query for the service provider and if it's not there I have to be able to live without it.

The question that remains is, when I query the ServiceLoader for my impl at a later time, then I would find it registered, right? I assume that if my module specifies "provides <my service> with <my provider>", the provider will automatically be registered once the module is loaded. Can you confirm that?


> -----Original Message-----
> From: Alan Bateman [mailto:Alan.Bateman at oracle.com]
> Sent: Mittwoch, 15. Februar 2017 13:22
> To: David Holmes <david.holmes at oracle.com>; Langer, Christoph
> <christoph.langer at sap.com>; Chris Hegarty <chris.hegarty at oracle.com>;
> Weijun Wang <weijun.wang at oracle.com>
> Cc: jigsaw-dev at openjdk.java.net
> Subject: Re: Extending java.base module
> On 15/02/2017 12:10, David Holmes wrote:
> > On 15/02/2017 8:03 PM, Langer, Christoph wrote:
> >> Hi Chris, Max,
> >>
> >> thanks for your quick answers. So the service approach seems to fit
> >> quite well.
> >>
> >> But can I assume that my service implementation will be available
> >> already at "bootstrap time" of the JDK? E.g. if I need to
> >> register/reach my service already at the early stages of JVM
> >> initialization, e.g. when a class java.lang.Thread gets initialized,
> >> can I assume a service from my extension module would be available?
> >
> > I'm pretty sure the answer to that will be No! Thread is one of the
> > earlier classes to be initialized, the module system is initialized
> > much later.
> That's right as only classes in java.base can be loaded during startup.
> I don't know what services that Christoph is thinking of but hopefully
> they can be deferred until the VM is initialized.
> -Alan

More information about the jigsaw-dev mailing list