JPMS Runtime Swappable Modules
forax at univ-mlv.fr
Tue Feb 9 15:28:51 UTC 2021
----- Mail original -----
> De: "Alan Bateman" <Alan.Bateman at oracle.com>
> À: "Eric Bresie" <ebresie at gmail.com>
> Cc: "jdk-dev" <jdk-dev at openjdk.java.net>
> Envoyé: Mardi 9 Février 2021 15:37:49
> Objet: Re: JPMS Runtime Swappable Modules
> 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.
There is an open source project called Layrry , that is able to load/unload JPMS modules.
This project also comes with several interesting blog posts on how things work.
More information about the jdk-dev