Java Magazine, Mar/Apr 2018
ORACLE COM JAVAMAGAZINE MARCH APRIL 2018 51 microservices and containers The advantages of integration include Increased isolation changes to a single OSGi bundle within a JPMS layer likely will not require that layer or dependent layers to be rebuilt Bundles inherit Java module restrictions on split packages and circular dependencies Bundles inherit Java module compile time presence of all dependencies Migration OSGi bundle definition and resolution is maintained as is on top of Java modules Compatibility OSGi bundles will still work independently on Java SE 8 and earlier JVMs To integrate this way the Java math module code in the earlier example will simply extend the OSGi math bundle built earlier The package names in the OSGi bundle code need to be changed slightly resulting in the combined directory structure shown in Figure 7 The code in Listing 3 contains the two implementations for the math module The actual implementation is in the OSGi bundle while the Java module simply extends it Listing 3 Integrating the OSGi math bundle and the Java math module package osgi simulation math impl import osgi simulation math SimulationMath public class MyMathImpl implements SimulationMath Actual implementation here package example simulation math JPMS Module extends OSGi Bundle Figure 7 The simulation math Java module extends the OSGi math bundle implementations
You must have JavaScript enabled to view digital editions.