New issue: run time eager module loading

mark.reinhold at mark.reinhold at
Fri Mar 11 17:47:51 UTC 2016

2016/3/2 19:22 -0800, david.lloyd at
> It looks as though the instantiation of a Layer causes a complete load 
> of all the modules in the layer.

What do you mean by "complete load"?  Loading all the classes?

>                                   Apart from the consequent lack of 
> dynamicism, I think this is very likely to cause problems for large 
> applications, particularly if such an application might have many 
> operation modes, some of which do not require *all* of the bundled 
> modules to be loaded every single time.
> Can there not instead be an incremental resolution algorithm, akin to 
> how classes are lazily loaded?

Configuring a set of modules and instantiating that configuration as a
layer requires no more than reading the modules' descriptors.  Nothing
else from any module definition will be read until it's actually needed.

If you really want to avoid configuring all modules in certain operation
modes, do layers not provide sufficient flexibility?  Load the core of
your application into the boot layer, figure out which modules you need
for the requested operation mode, and then create an additional layer to
load those modules.

- Mark

More information about the jpms-spec-experts mailing list