Java Magazine, Mar/Apr 2018
ORACLE COM JAVAMAGAZINE MARCH APRIL 2018 50 microservices and containers and the combination extends modularity support from top to bottom Figure 6 To ensure that existing Java applications can run with Java 9 as is that is without explicitly defining modules for existing code the JVM by default runs in compatibility mode It does this by creating an unnamed module in which to place nonmodular application code When OSGi is run on Java SE 9 in compatibility mode the JVM automatically creates an unnamed module per OSGi Services Bundles Java Module Lifecycle Modules Security OS Java OSGi App Focus of modularity OSGi Execution Environment Java 9 V irtual Machine Java Platform Management System Operating System Figure 6 When OSGi is layered on top of JPMS modularity is extended from the application to libraries through to the JVM itself with full lifecycle control bundle service and execution environment However explicit Java modules those designed to be real Java 9 modules not in compatibility mode cannot import unnamed modules Therefore to import OSGi bundles all OSGi bundles in your application and the execution environment must be loaded within a matching Java 9 module Doing this requires the following Bundle imports match module requires Bundle names match module names Bundle versions match module versions Private classes might need to be made accessible to all A module layer must be defined per bundle dependency in the graph in which nodes are modules and edges define dependencies between modules Java 9 layers allow new modules to be added to a running application just as OSGi bundles allow new implementations to be loaded started stopped and even updated within a running application
You must have JavaScript enabled to view digital editions.