Seems to me like a good argument for layers as sets of interdependent modules, as a module using another module prevents unloading the other module for real, as references still exist to it from the first module. Although I am not a module expert and trying to learn a bit about those things. As for jboss allowing dynamic dependency modification, I just haven't found that ability, but I have looked mainly at Module, ModuleLoader and such classes.
W dniu 03.01.2018 o 15:04, David Lloyd pisze: > On Sun, Dec 31, 2017 at 10:06 AM, Michał Zegan > <webczat_...@poczta.onet.pl> wrote: >> Is that planned to be added? Or even needed? I wanted to compare jpms >> api to jboss-modules and seems to me that jboss-modules does not have >> the dependency modification capability at all at the first glance. > > JBoss Modules does allow modification of dependencies and even > unloading of modules, however it must be done carefully (of course) > with an understanding of how class loading works. > > This is not something that you will commonly want or need to do, > because Java class linkage is a one-time operation. This means that > if your module X depends on module A and a class from X links to a > class form A, and you change the dependency from module A to module B, > X will still have a connection to module A via the already-linked > class. This is possibly the simplest example of where problems may > begin. > > That said, the JBoss OSGi project uses this feature to implement its > relinking capabilities. It mitigates the possible problems by way of > its service container which helps to minimize the risk of problematic > activity. >