JPMS Runtime Swappable Modules

Alan Bateman Alan.Bateman at oracle.com
Tue Feb 9 14:37:49 UTC 2021


On 09/02/2021 14:03, Eric Bresie wrote:
> I’m still new to JPMS but in project discussion elsewhere, someone made the
> observation that JPMS modules could not be swapped out during run time.  Is
> this correct?
>
> If its not possible, are there any plans to allow for a module to be
> hot-swappable during runtime (I guess similar to OSGI)
In the Java Module System (the acronym "JPMS" is not used help), there 
is API support for loading coherent sets of modules at runtime. Look for 
"ModuleLayer" in the API docs.  You can load many layers with different 
versions of modules in different layers. Module layers are eligible to 
be GC'ed and  unloaded then they are no longer referenced. So if you do 
have a need for dynamic usages then think of it as loading and unloading 
of coherent graphs of modules rather than modules in isolation.

If you run into issue or have specific questions then it may be better 
to bring them to the jigsaw-dev mailing list rather than here.

-Alan.




More information about the jdk-dev mailing list