SlideShare uma empresa Scribd logo
1 de 26
Baixar para ler offline
OSGi and Java 9+ BJ Hargrave, IBM
Java 9 introduced the Java Platform Module System (JPMS)
• JPMS was primarily added to Java to enable modularization of the Java
platform
• Internals can be encapsulated to avoid dependencies - sun.misc.Unsafe
• Platform can be safely subset - jlink
• But JPMS can also be used by application code running on the platform
• But migration from plain JAR to module is a huge challenge
• It really depends on the bottom level dependencies going first
But JPMS really falls short for general use in applications
• The Java platform is a single code base, so all the modules are built together
and releases together
• Applications are almost never like this, they are composed of many modules
• From many sources including open source projects
• Released individually on their own schedules
• Potential for version conflicts in shared dependencies
Main Shortfalls
• Isolation - JPMS uses a single class loader per layer by default. So your non-exported
(private) packages can conflict with someone else’s non-exported (private) packages:
shadowing.
• Identity dependency - Modules depend upon the names of other module not things used
at runtime: classes in packages. So module names are API. As are transitive requirements
• Access restrictions - Reflection is not allowed unless you “open” your module. This is a
challenge for dependency injection and annotation scanning. You often don’t and
shouldn’t know the name of the module which needs to reflect upon you nor should you
put code, which needs reflection, in exported packages.
• Versioning - ??? Someone else’s problem. Like yours!
Java 9+ support in OSGi Core R7
Changes in Core R7 for Java 9+
• Multi-Release JARs (MRJAR)
• Runtime discovery of platform packages
• Bundle can import java.* packages
• Backwards compatible with pre-Java 9 and past releases of OSGi Core
Multi-Release JARs (MRJAR)
• A MRJAR file allows for a single JAR to support multiple major versions of the Java platform
• For example, a MRJAR file can depend on both the Java 8 and Java 9 major platform releases,
where some class files depend on APIs from Java 8 and other class file depend on APIs added
in Java 9
• The purpose is to support alternative implementations of select classes to deal with changes in the
visible APIs of the Java platform
• It is not meant as a means to supply new function or new API on different Java platform versions
• Only supported on Java 9 and above
• Multi-Release: true
MRJAR example
META-INF/MANIFEST.MF
com/example/foo/Bar.class
com/example/foo/bar.properties
META-INF/versions/9/com/example/foo/Bar.class
META-INF/versions/10/com/example/foo/bar.properties
META-INF/versions/11/com/example/foo/Bar.class
MRJAR Java 8 effective content
META-INF/MANIFEST.MF
com/example/foo/Bar.class
com/example/foo/bar.properties
META-INF/versions/9/com/example/foo/Bar.class
META-INF/versions/10/com/example/foo/bar.properties
META-INF/versions/11/com/example/foo/Bar.class
MRJAR Java 9 effective content
META-INF/MANIFEST.MF
com/example/foo/Bar.class
com/example/foo/bar.properties
META-INF/versions/9/com/example/foo/Bar.class
META-INF/versions/10/com/example/foo/bar.properties
META-INF/versions/11/com/example/foo/Bar.class
MRJAR Java 10 effective content
META-INF/MANIFEST.MF
com/example/foo/Bar.class
com/example/foo/bar.properties
META-INF/versions/9/com/example/foo/Bar.class
META-INF/versions/10/com/example/foo/bar.properties
META-INF/versions/11/com/example/foo/Bar.class
MRJAR Java 11 effective content
META-INF/MANIFEST.MF
com/example/foo/Bar.class
com/example/foo/bar.properties
META-INF/versions/9/com/example/foo/Bar.class
META-INF/versions/10/com/example/foo/bar.properties
META-INF/versions/11/com/example/foo/Bar.class
Multi-Release Bundles
• A bundle can be a multi-release bundle when it has Multi-Release: true in its manifest
• When a bundle is multi-release, the framework must look for the presence of a supplemental manifest
in a versioned folder of the bundle
• META-INF/versions/9/OSGI-INF/MANIFEST.MF
• The supplemental manifest, from the highest versioned folder, can contain Import-Package and
Require-Capability headers which replace the headers from the main manifest
• Since the alternate class implementations in the versioned folder can require different dependencies
• As a best practice, a supplemental manifest should not contain additional requirements on
capabilities which are not supplied by the Java platform for the Java version associated with the
supplemental manifest
Multi-Release Containers
• In additional to the bundle itself, a bundle’s class path can specify multiple
containers and each container can also be multi-release
• Bundle-ClassPath: ., libs/foo.jar
• A container must have Multi-Release: true in its manifest to be
recognized as a multi-release container
• When a container is a multi-release container, the framework must look in the
versioned folders when attempting to locate a class or resource in the
container
Runtime discovery of platform packages
• Now that the Java platform is modularized, the platform can be configured to
load only certain modules
• You can have a smaller, custom runtime that is tailored to the needs of a
specific application => jlink
• So the set of java.* packages provide by the running Java platform is no
longer constant for a specific version of the Java platform!
• So R7 frameworks must ask the platform for the current set of java.*
packages and use that to set the
org.osgi.framework.system.packages property
Importing java.* packages
• Bundle have used a requirement on the osgi.ee capability as a proxy for the set of java.*
packages they may require
• Given that the set of available java.* packages can vary, the osgi.ee requirement can
now only be used to express the JVM requirement
• e.g. Java 10 class file support needed
• Bundles are now permitted to list java.* packages in their Import-Package
• This can be used by the framework to resolve the bundle to ensure their java.* package
requirements can be met
• But class loading for java.* packages is still the same: parent delegation
Experiments
Credit
• Tom Watson is the mad genius behind these OSGi experiments with JPMS
• So all credit goes to Tom
• I am just reporting on them
“OSGi Sandwich” - https://github.com/tjwatson/osgi-jpms-layer
Java Module Layers and OSGi Bundles: First Try
Java Module Layers and OSGi Bundles: Second Try
Atomos - https://github.com/tjwatson/atomos
Tools
Tooling
• Bnd support
• MRJARs
• Import java.* packages when targeting Core R7
• Make jars that are bundles and modules?
• Automatic enrichment of module-info based upon annotations?
• Shading non-exported packages?
Thanks!
Evaluate the Sessions
-1 0 +1
Sign in and vote at eclipsecon.org

Mais conteúdo relacionado

Mais procurados

Introduction to OSGi
Introduction to OSGiIntroduction to OSGi
Introduction to OSGipradeepfn
 
Understanding Java Dynamic Proxies
Understanding Java Dynamic ProxiesUnderstanding Java Dynamic Proxies
Understanding Java Dynamic ProxiesRafael Luque Leiva
 
Tuscany : Applying OSGi After The Fact
Tuscany : Applying  OSGi After The FactTuscany : Applying  OSGi After The Fact
Tuscany : Applying OSGi After The FactLuciano Resende
 
System Architecture using Maven Modularity
System Architecture using Maven ModularitySystem Architecture using Maven Modularity
System Architecture using Maven ModularityScheidt & Bachmann
 
MyFaces CODI Conversations
MyFaces CODI ConversationsMyFaces CODI Conversations
MyFaces CODI Conversationsos890
 
itft-Java evolution
itft-Java evolutionitft-Java evolution
itft-Java evolutionAtul Sehdev
 
Wonderful World of Maven
Wonderful World of MavenWonderful World of Maven
Wonderful World of MavenJustin J. Moses
 
S/W Design and Modularity using Maven
S/W Design and Modularity using MavenS/W Design and Modularity using Maven
S/W Design and Modularity using MavenScheidt & Bachmann
 
Maven, Eclipse and OSGi Working Together - Carlos Sanchez
Maven, Eclipse and OSGi Working Together - Carlos SanchezMaven, Eclipse and OSGi Working Together - Carlos Sanchez
Maven, Eclipse and OSGi Working Together - Carlos Sanchezmfrancis
 
JavaPerformanceChapter_3
JavaPerformanceChapter_3JavaPerformanceChapter_3
JavaPerformanceChapter_3Saurav Basu
 
Polygot Java EE on the GraalVM
Polygot Java EE on the GraalVMPolygot Java EE on the GraalVM
Polygot Java EE on the GraalVMRyan Cuprak
 
開放原始碼 Ch1.2 intro - oss - apahce foundry (ver 2.0)
開放原始碼 Ch1.2   intro - oss - apahce foundry (ver 2.0)開放原始碼 Ch1.2   intro - oss - apahce foundry (ver 2.0)
開放原始碼 Ch1.2 intro - oss - apahce foundry (ver 2.0)My own sweet home!
 
JRuby in the enterprise
JRuby in the enterpriseJRuby in the enterprise
JRuby in the enterpriseJerry Gulla
 
The Evolution of Java
The Evolution of JavaThe Evolution of Java
The Evolution of JavaFu Cheng
 

Mais procurados (20)

Introduction to OSGi
Introduction to OSGiIntroduction to OSGi
Introduction to OSGi
 
Understanding Java Dynamic Proxies
Understanding Java Dynamic ProxiesUnderstanding Java Dynamic Proxies
Understanding Java Dynamic Proxies
 
Tuscany : Applying OSGi After The Fact
Tuscany : Applying  OSGi After The FactTuscany : Applying  OSGi After The Fact
Tuscany : Applying OSGi After The Fact
 
Apache Maven In 10 Slides
Apache Maven In 10 SlidesApache Maven In 10 Slides
Apache Maven In 10 Slides
 
System Architecture using Maven Modularity
System Architecture using Maven ModularitySystem Architecture using Maven Modularity
System Architecture using Maven Modularity
 
MyFaces CODI Conversations
MyFaces CODI ConversationsMyFaces CODI Conversations
MyFaces CODI Conversations
 
itft-Java evolution
itft-Java evolutionitft-Java evolution
itft-Java evolution
 
Wonderful World of Maven
Wonderful World of MavenWonderful World of Maven
Wonderful World of Maven
 
S/W Design and Modularity using Maven
S/W Design and Modularity using MavenS/W Design and Modularity using Maven
S/W Design and Modularity using Maven
 
Maven, Eclipse and OSGi Working Together - Carlos Sanchez
Maven, Eclipse and OSGi Working Together - Carlos SanchezMaven, Eclipse and OSGi Working Together - Carlos Sanchez
Maven, Eclipse and OSGi Working Together - Carlos Sanchez
 
JavaPerformanceChapter_3
JavaPerformanceChapter_3JavaPerformanceChapter_3
JavaPerformanceChapter_3
 
Polygot Java EE on the GraalVM
Polygot Java EE on the GraalVMPolygot Java EE on the GraalVM
Polygot Java EE on the GraalVM
 
Dynamic Proxy by Java
Dynamic Proxy by JavaDynamic Proxy by Java
Dynamic Proxy by Java
 
開放原始碼 Ch1.2 intro - oss - apahce foundry (ver 2.0)
開放原始碼 Ch1.2   intro - oss - apahce foundry (ver 2.0)開放原始碼 Ch1.2   intro - oss - apahce foundry (ver 2.0)
開放原始碼 Ch1.2 intro - oss - apahce foundry (ver 2.0)
 
JRuby in the enterprise
JRuby in the enterpriseJRuby in the enterprise
JRuby in the enterprise
 
Delving Deeper Into OSGI Modularity
Delving Deeper Into OSGI ModularityDelving Deeper Into OSGI Modularity
Delving Deeper Into OSGI Modularity
 
The Evolution of Java
The Evolution of JavaThe Evolution of Java
The Evolution of Java
 
AtoM feature development
AtoM feature developmentAtoM feature development
AtoM feature development
 
History of java'
History of java'History of java'
History of java'
 
Java History
Java HistoryJava History
Java History
 

Semelhante a OSGi and Java 9+

Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil BartlettJava Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil BartlettJAX London
 
Java Platform Module System
Java Platform Module SystemJava Platform Module System
Java Platform Module SystemVignesh Ramesh
 
OpenJDK Penrose Presentation (JavaOne 2012)
OpenJDK Penrose Presentation (JavaOne 2012)OpenJDK Penrose Presentation (JavaOne 2012)
OpenJDK Penrose Presentation (JavaOne 2012)David Bosschaert
 
Create *real* modular Java applications - a brief introduction -
Create *real* modular Java applications - a brief introduction -Create *real* modular Java applications - a brief introduction -
Create *real* modular Java applications - a brief introduction -Jeffrey Groneberg
 
Introduction to OSGi - Part-1
Introduction to OSGi - Part-1Introduction to OSGi - Part-1
Introduction to OSGi - Part-1kshanth2101
 
Preparing for java 9 modules upload
Preparing for java 9 modules uploadPreparing for java 9 modules upload
Preparing for java 9 modules uploadRyan Cuprak
 
Enterprise OSGi at eBay
Enterprise OSGi at eBayEnterprise OSGi at eBay
Enterprise OSGi at eBayTony Ng
 
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)Modularity of the Java Platform (OSGi, Jigsaw and Penrose)
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)Martin Toshev
 
Apache maven and its impact on java 9 (Java One 2017)
Apache maven and its impact on java 9 (Java One 2017)Apache maven and its impact on java 9 (Java One 2017)
Apache maven and its impact on java 9 (Java One 2017)Robert Scholte
 
Java9 and the impact on Maven Projects (JFall 2016)
Java9 and the impact on Maven Projects (JFall 2016)Java9 and the impact on Maven Projects (JFall 2016)
Java9 and the impact on Maven Projects (JFall 2016)Robert Scholte
 
What’s expected in Java 9
What’s expected in Java 9What’s expected in Java 9
What’s expected in Java 9Gal Marder
 
Leaner microservices with Java 10
Leaner microservices with Java 10Leaner microservices with Java 10
Leaner microservices with Java 10Arto Santala
 
Building modular applications with the Java Platform Module System and Layrry
Building modular applications with the Java Platform Module System and LayrryBuilding modular applications with the Java Platform Module System and Layrry
Building modular applications with the Java Platform Module System and LayrryAndres Almiray
 
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)Mihail Stoynov
 
Modularity of The Java Platform Javaday (http://javaday.org.ua/)
Modularity of The Java Platform Javaday (http://javaday.org.ua/)Modularity of The Java Platform Javaday (http://javaday.org.ua/)
Modularity of The Java Platform Javaday (http://javaday.org.ua/)Martin Toshev
 

Semelhante a OSGi and Java 9+ (20)

Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil BartlettJava Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
 
Java Platform Module System
Java Platform Module SystemJava Platform Module System
Java Platform Module System
 
OpenJDK Penrose Presentation (JavaOne 2012)
OpenJDK Penrose Presentation (JavaOne 2012)OpenJDK Penrose Presentation (JavaOne 2012)
OpenJDK Penrose Presentation (JavaOne 2012)
 
Create *real* modular Java applications - a brief introduction -
Create *real* modular Java applications - a brief introduction -Create *real* modular Java applications - a brief introduction -
Create *real* modular Java applications - a brief introduction -
 
Introduction to OSGi - Part-1
Introduction to OSGi - Part-1Introduction to OSGi - Part-1
Introduction to OSGi - Part-1
 
Preparing for java 9 modules upload
Preparing for java 9 modules uploadPreparing for java 9 modules upload
Preparing for java 9 modules upload
 
OSGi & Blueprint
OSGi & BlueprintOSGi & Blueprint
OSGi & Blueprint
 
perl-java
perl-javaperl-java
perl-java
 
perl-java
perl-javaperl-java
perl-java
 
Enterprise OSGi at eBay
Enterprise OSGi at eBayEnterprise OSGi at eBay
Enterprise OSGi at eBay
 
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)Modularity of the Java Platform (OSGi, Jigsaw and Penrose)
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)
 
Apache maven and its impact on java 9 (Java One 2017)
Apache maven and its impact on java 9 (Java One 2017)Apache maven and its impact on java 9 (Java One 2017)
Apache maven and its impact on java 9 (Java One 2017)
 
Java9 and the impact on Maven Projects (JFall 2016)
Java9 and the impact on Maven Projects (JFall 2016)Java9 and the impact on Maven Projects (JFall 2016)
Java9 and the impact on Maven Projects (JFall 2016)
 
What’s expected in Java 9
What’s expected in Java 9What’s expected in Java 9
What’s expected in Java 9
 
Leaner microservices with Java 10
Leaner microservices with Java 10Leaner microservices with Java 10
Leaner microservices with Java 10
 
Java 9, JShell, and Modularity
Java 9, JShell, and ModularityJava 9, JShell, and Modularity
Java 9, JShell, and Modularity
 
Building modular applications with the Java Platform Module System and Layrry
Building modular applications with the Java Platform Module System and LayrryBuilding modular applications with the Java Platform Module System and Layrry
Building modular applications with the Java Platform Module System and Layrry
 
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
 
Java modules
Java modulesJava modules
Java modules
 
Modularity of The Java Platform Javaday (http://javaday.org.ua/)
Modularity of The Java Platform Javaday (http://javaday.org.ua/)Modularity of The Java Platform Javaday (http://javaday.org.ua/)
Modularity of The Java Platform Javaday (http://javaday.org.ua/)
 

Mais de bjhargrave

The new OSGi LogService 1.4 and integrating with SLF4J
The new OSGi LogService 1.4 and integrating with SLF4JThe new OSGi LogService 1.4 and integrating with SLF4J
The new OSGi LogService 1.4 and integrating with SLF4Jbjhargrave
 
Constructor injection and other new features for Declarative Services 1.4
Constructor injection and other new features for Declarative Services 1.4Constructor injection and other new features for Declarative Services 1.4
Constructor injection and other new features for Declarative Services 1.4bjhargrave
 
Field injection, type safe configuration, and more new goodies in Declarative...
Field injection, type safe configuration, and more new goodies in Declarative...Field injection, type safe configuration, and more new goodies in Declarative...
Field injection, type safe configuration, and more new goodies in Declarative...bjhargrave
 
Services-First Migration to OSGi
Services-First Migration to OSGiServices-First Migration to OSGi
Services-First Migration to OSGibjhargrave
 
OSGi 4.3 Technical Update: What's New?
OSGi 4.3 Technical Update: What's New?OSGi 4.3 Technical Update: What's New?
OSGi 4.3 Technical Update: What's New?bjhargrave
 

Mais de bjhargrave (7)

The new OSGi LogService 1.4 and integrating with SLF4J
The new OSGi LogService 1.4 and integrating with SLF4JThe new OSGi LogService 1.4 and integrating with SLF4J
The new OSGi LogService 1.4 and integrating with SLF4J
 
Constructor injection and other new features for Declarative Services 1.4
Constructor injection and other new features for Declarative Services 1.4Constructor injection and other new features for Declarative Services 1.4
Constructor injection and other new features for Declarative Services 1.4
 
Field injection, type safe configuration, and more new goodies in Declarative...
Field injection, type safe configuration, and more new goodies in Declarative...Field injection, type safe configuration, and more new goodies in Declarative...
Field injection, type safe configuration, and more new goodies in Declarative...
 
Services-First Migration to OSGi
Services-First Migration to OSGiServices-First Migration to OSGi
Services-First Migration to OSGi
 
Why OSGi?
Why OSGi?Why OSGi?
Why OSGi?
 
OSGi Puzzlers
OSGi PuzzlersOSGi Puzzlers
OSGi Puzzlers
 
OSGi 4.3 Technical Update: What's New?
OSGi 4.3 Technical Update: What's New?OSGi 4.3 Technical Update: What's New?
OSGi 4.3 Technical Update: What's New?
 

Último

Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 

Último (20)

Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 

OSGi and Java 9+

  • 1. OSGi and Java 9+ BJ Hargrave, IBM
  • 2. Java 9 introduced the Java Platform Module System (JPMS) • JPMS was primarily added to Java to enable modularization of the Java platform • Internals can be encapsulated to avoid dependencies - sun.misc.Unsafe • Platform can be safely subset - jlink • But JPMS can also be used by application code running on the platform • But migration from plain JAR to module is a huge challenge • It really depends on the bottom level dependencies going first
  • 3. But JPMS really falls short for general use in applications • The Java platform is a single code base, so all the modules are built together and releases together • Applications are almost never like this, they are composed of many modules • From many sources including open source projects • Released individually on their own schedules • Potential for version conflicts in shared dependencies
  • 4. Main Shortfalls • Isolation - JPMS uses a single class loader per layer by default. So your non-exported (private) packages can conflict with someone else’s non-exported (private) packages: shadowing. • Identity dependency - Modules depend upon the names of other module not things used at runtime: classes in packages. So module names are API. As are transitive requirements • Access restrictions - Reflection is not allowed unless you “open” your module. This is a challenge for dependency injection and annotation scanning. You often don’t and shouldn’t know the name of the module which needs to reflect upon you nor should you put code, which needs reflection, in exported packages. • Versioning - ??? Someone else’s problem. Like yours!
  • 5. Java 9+ support in OSGi Core R7
  • 6. Changes in Core R7 for Java 9+ • Multi-Release JARs (MRJAR) • Runtime discovery of platform packages • Bundle can import java.* packages • Backwards compatible with pre-Java 9 and past releases of OSGi Core
  • 7. Multi-Release JARs (MRJAR) • A MRJAR file allows for a single JAR to support multiple major versions of the Java platform • For example, a MRJAR file can depend on both the Java 8 and Java 9 major platform releases, where some class files depend on APIs from Java 8 and other class file depend on APIs added in Java 9 • The purpose is to support alternative implementations of select classes to deal with changes in the visible APIs of the Java platform • It is not meant as a means to supply new function or new API on different Java platform versions • Only supported on Java 9 and above • Multi-Release: true
  • 9. MRJAR Java 8 effective content META-INF/MANIFEST.MF com/example/foo/Bar.class com/example/foo/bar.properties META-INF/versions/9/com/example/foo/Bar.class META-INF/versions/10/com/example/foo/bar.properties META-INF/versions/11/com/example/foo/Bar.class
  • 10. MRJAR Java 9 effective content META-INF/MANIFEST.MF com/example/foo/Bar.class com/example/foo/bar.properties META-INF/versions/9/com/example/foo/Bar.class META-INF/versions/10/com/example/foo/bar.properties META-INF/versions/11/com/example/foo/Bar.class
  • 11. MRJAR Java 10 effective content META-INF/MANIFEST.MF com/example/foo/Bar.class com/example/foo/bar.properties META-INF/versions/9/com/example/foo/Bar.class META-INF/versions/10/com/example/foo/bar.properties META-INF/versions/11/com/example/foo/Bar.class
  • 12. MRJAR Java 11 effective content META-INF/MANIFEST.MF com/example/foo/Bar.class com/example/foo/bar.properties META-INF/versions/9/com/example/foo/Bar.class META-INF/versions/10/com/example/foo/bar.properties META-INF/versions/11/com/example/foo/Bar.class
  • 13. Multi-Release Bundles • A bundle can be a multi-release bundle when it has Multi-Release: true in its manifest • When a bundle is multi-release, the framework must look for the presence of a supplemental manifest in a versioned folder of the bundle • META-INF/versions/9/OSGI-INF/MANIFEST.MF • The supplemental manifest, from the highest versioned folder, can contain Import-Package and Require-Capability headers which replace the headers from the main manifest • Since the alternate class implementations in the versioned folder can require different dependencies • As a best practice, a supplemental manifest should not contain additional requirements on capabilities which are not supplied by the Java platform for the Java version associated with the supplemental manifest
  • 14. Multi-Release Containers • In additional to the bundle itself, a bundle’s class path can specify multiple containers and each container can also be multi-release • Bundle-ClassPath: ., libs/foo.jar • A container must have Multi-Release: true in its manifest to be recognized as a multi-release container • When a container is a multi-release container, the framework must look in the versioned folders when attempting to locate a class or resource in the container
  • 15. Runtime discovery of platform packages • Now that the Java platform is modularized, the platform can be configured to load only certain modules • You can have a smaller, custom runtime that is tailored to the needs of a specific application => jlink • So the set of java.* packages provide by the running Java platform is no longer constant for a specific version of the Java platform! • So R7 frameworks must ask the platform for the current set of java.* packages and use that to set the org.osgi.framework.system.packages property
  • 16. Importing java.* packages • Bundle have used a requirement on the osgi.ee capability as a proxy for the set of java.* packages they may require • Given that the set of available java.* packages can vary, the osgi.ee requirement can now only be used to express the JVM requirement • e.g. Java 10 class file support needed • Bundles are now permitted to list java.* packages in their Import-Package • This can be used by the framework to resolve the bundle to ensure their java.* package requirements can be met • But class loading for java.* packages is still the same: parent delegation
  • 18. Credit • Tom Watson is the mad genius behind these OSGi experiments with JPMS • So all credit goes to Tom • I am just reporting on them
  • 19. “OSGi Sandwich” - https://github.com/tjwatson/osgi-jpms-layer
  • 20. Java Module Layers and OSGi Bundles: First Try
  • 21. Java Module Layers and OSGi Bundles: Second Try
  • 23. Tools
  • 24. Tooling • Bnd support • MRJARs • Import java.* packages when targeting Core R7 • Make jars that are bundles and modules? • Automatic enrichment of module-info based upon annotations? • Shading non-exported packages?
  • 26. Evaluate the Sessions -1 0 +1 Sign in and vote at eclipsecon.org