SlideShare a Scribd company logo
1 of 43
Download to read offline
JAVA 8 MODULES, JIGSAW
       AND OSGi
     Neil Bartlett with Tim Ellison
MOTIVATION
WHY MODULARISE THE JDK?

• The   JRE is monolithic

• Download time and start-up time are directly affected by
 number of types available at runtime

• Start-uptime includes a linear search through the class path to
 find system and application code

  • Oracle     1.7 Windows boot classpath nearly 20k classes

  • rt.jar   index alone is approx 1Mb
OSGi

• If   only Java had a module system that could help with that!

• As    we all know, OSGi will not be used for JDK modularity
JIGSAW MOTIVATION

• JRElibraries evolved organically and haphazardly over 13+
 years

• Many   cyclic dependencies

• Many   weird/unexpected dependencies

• E.g.: java.util     is an incoherent mess

• Splitting   packages is unavoidable
Good news, everyone!

 OSGi supports split
 packages, using Require-
        Bundle.
SINGLE CLASSLOADER

• Yeah   but there’s the single classloader assumption...

• Many    parts of the JRE assume a single boot classloader

• Package-private (“default”) accessibility requires whole
 packages in single classloader

• Need  to split packages across modules but not across
 classloaders

• Break   the one-to-one mapping of modules to classloaders
OSGi supports shared
  classloaders, using
      Fragments.
DEPENDENCY DIRECTION


• Yeah, but
          the dependency goes in the “wrong” direction
 (fragment depends on host).

• Jigsaw
       wants the “host” to depend on the “fragment”: host
 shouldn’t resolve if fragment unavailable.
OSGi R4.3 supports
  that too using generic
requirements/capabilities.
REUSE



• Yeahbut the fragment still depends on the host and cannot be
 used by other hosts.
...
Pretty sure we could have
supported this, if only you
   had talked to us.
REFACTORING


• Usual and best solution: move classes to the correct, most
 logical place

• Obviously   impossible in the JRE.

•9 million Java developers (Sun estimate, 2009) and billions
 of apps depend on this library.
JIGSAW
MODULES

• Module    declared in module-info.java (module-info.class)

• All   new keywords are “scoped”


        module B @ 1.0 {
           ...
        }
REQUIRES

• Modules   require other modules by name (and optionally,
 version)


     module B @ 1.0 {
        require A @ [2.0,3.0);
     }
LOCAL

• Requirements    can be marked “local”

• Target   module is loaded in same classloader


      module B @ 1.0 {
         require local A @ [2.0,3.0);
      }
EXPORTS

• Modules   list their exports, at package and type level

• May   include re-exported contents of required modules

        module B @ 1.0 {
           require A @ [2.0,3.0);
           export org.foo.ClassFoo;
           export org.bar.*;
        }
FRIENDS

• Modules   can control which other modules require them

• Compare   with “friend” classes in C++

• N.B. permit   clause is not versioned.

      module A @ 2.0 {
         permit B;
      }
PROVIDES

• Modules    can logically “provide” other modules names

• Compare    with “virtual packages” in Debian

• Supports   substitution, but not refactoring (splits or joins)

     module com.ibm.stax @ 1.0 {
        provide jdk.stax @ 2.0;
     }
ENTRY POINT

• Modules   can have a single entry-point class

• Compare    with Main-Class header in Jar manifests.

     module A @ 2.0 {
        permit B;
        class org.foo.Main;
     }
VERSIONS


• Modules   will be versioned

• Requirements   use exact version or a range

• No   version semantics beyond ordering
COMPARISONS
LIFECYCLE

• Resolver solves dependencies in the face of multiple valid
 alternatives

• OSGi resolver finds best fit for currently installed bundles at
 runtime

• Jigsaw   resolves during build and installation

• Jigsaw   has no dynamics, no module lifecycle
METADATA



• Tools   required to inspect module-info.class

• OSGi    uses kind-of readable MANIFEST.MF
COMPARISON

• Whole-module    dependencies and split packages are the
 biggest differences

• Jigsaw
       will suffer all the same problems seen in OSGi with
 Require-Bundle (e.g. Eclipse Core Runtime refactoring mess)

• While Jigsaw will technically achieve JDK modularity it will
 increase developer maintenance burden
INTEROP
INTEROP


• Both    are here to stay... try to get the best of both worlds!

• OSGi     is established and will continue to be used widely

• Jigsaw   is underway and a key component of Java 8

• It   need not be a zero-sum game
JAVA 8 REQUIREMENTS

• “It must be demonstrated by prototype to be feasible to
  modify an OSGi micro-kernel such that OSGi bundles running
  in that kernel can depend upon Java modules. The kernel must
  be able to load Java modules directly and resolve them using
  its own resolver, except for core system modules. Core system
  modules can only be loaded using the module system’s
  reification API.”

• http://openjdk.java.net/projects/jigsaw/doc/draft-java-module-
  system-requirements-12
PROJECT PENROSE



• OpenJDK-hosted       project to work on Jigsaw/OSGi interop

• Project   lead is Tim Ellison
LEVELS

0              Tolerate


1             Understand


2               Exploit


3+            Cooperate
LEVEL 0: TOLERATE


• Ensure that OSGi frameworks continue to run unmodified on
 Jigsaw-enabled runtime.

• Creating
         modules/bundles that have both Jigsaw and OSGi
 metadata on the same JAR.
LEVEL 1: UNDERSTAND


• Teach   OSGi to read Jigsaw module info

 • Mapping Jigsaw metadata into OSGi concepts e.g. requires =
   Require-Bundle, exports = Export-Package.

• Resolve   Jigsaw modules using the OSGi resolver.
LEVEL 2: EXPLOIT



• OSGi   implementation exploits Jigsaw modularity

• E.g. use   Jigsaw publication repositories.
LEVEL 3+: COOPERATE



•Ablend of OSGi and Jigsaw cross-delegation on module
phases.
ACHIEVEMENT 1


• Passed   the OSGi tests on a Jigsaw-enabled runtime

 • Equinox    3.7, the OSGi Reference Implementation.

 • OSGi    R4.3 Compliance Tests
ACHIEVEMENT 2


• Run   a Java application as either OSGi or Jigsaw modules

 • Took   a Java 2D demo

 • Brokeinto multiple functional units, run demo as either
   OSGi bundles or Jigsaw modules
GOAL 1



• Map   Jigsaw module metadata to OSGi equivalents

• Discussion: how   to interpret Jigsaw directives
GOAL 2


• Modify   OSGi (Equinox) to use Jigsaw reification APIs

 • Load    a 3rd-party module from the Jigsaw repository

 • Resolve   it using the OSGi resolver
TIMELINE


• Java   8: summer 2013? Code freeze early 2013.

• Jigsaw   seems to be basically “done”, with little recent activity

• No     JSR yet, or perhaps ever.

• If   we need changes in Jigsaw, we need to push them soon.
GET INVOLVED


• Penrose   home & mailing list:

 • http://openjdk.java.net/projects/penrose/

• Hg   repository:

 • http://hg.openjdk.java.net/penrose/jigsaw/
Java 8 modules, Jigsaw and OSGi - Neil Bartlett

More Related Content

Viewers also liked

Exit Readiness to Maximize Enterprise Value
Exit Readiness to Maximize Enterprise ValueExit Readiness to Maximize Enterprise Value
Exit Readiness to Maximize Enterprise Valuedavidsaxe
 
The most incredible shopping malls
The most incredible shopping mallsThe most incredible shopping malls
The most incredible shopping mallsFernando Perdomo
 
Ch11 z5e solutions
Ch11 z5e solutionsCh11 z5e solutions
Ch11 z5e solutionsblachman
 
2Q10 Earnings Release
2Q10 Earnings Release2Q10 Earnings Release
2Q10 Earnings ReleaseGafisa RI !
 
Notating pop music
Notating pop musicNotating pop music
Notating pop musicxjkoboe
 
Student Facilitator Presentation
Student Facilitator PresentationStudent Facilitator Presentation
Student Facilitator PresentationZoe Christo
 
Crear Unha Conta Gmail
Crear Unha Conta GmailCrear Unha Conta Gmail
Crear Unha Conta Gmailvicente
 
Example of arrogance in quran the story of qarun and haman
Example of arrogance in quran the story of qarun and haman Example of arrogance in quran the story of qarun and haman
Example of arrogance in quran the story of qarun and haman Amel Hope
 
8 habits of highly effective language learners
8 habits of highly effective language learners8 habits of highly effective language learners
8 habits of highly effective language learnersPhilip Seifi
 

Viewers also liked (15)

Exit Readiness to Maximize Enterprise Value
Exit Readiness to Maximize Enterprise ValueExit Readiness to Maximize Enterprise Value
Exit Readiness to Maximize Enterprise Value
 
Final oral test
Final oral testFinal oral test
Final oral test
 
Boe February 10 2009 Agenda
Boe February 10 2009 AgendaBoe February 10 2009 Agenda
Boe February 10 2009 Agenda
 
The most incredible shopping malls
The most incredible shopping mallsThe most incredible shopping malls
The most incredible shopping malls
 
Ch11 z5e solutions
Ch11 z5e solutionsCh11 z5e solutions
Ch11 z5e solutions
 
2Q10 Earnings Release
2Q10 Earnings Release2Q10 Earnings Release
2Q10 Earnings Release
 
Jajajajajajajajaja
JajajajajajajajajaJajajajajajajajaja
Jajajajajajajajaja
 
Notating pop music
Notating pop musicNotating pop music
Notating pop music
 
Student Facilitator Presentation
Student Facilitator PresentationStudent Facilitator Presentation
Student Facilitator Presentation
 
Tsunami dari bnpb
Tsunami dari bnpbTsunami dari bnpb
Tsunami dari bnpb
 
Crear Unha Conta Gmail
Crear Unha Conta GmailCrear Unha Conta Gmail
Crear Unha Conta Gmail
 
Example of arrogance in quran the story of qarun and haman
Example of arrogance in quran the story of qarun and haman Example of arrogance in quran the story of qarun and haman
Example of arrogance in quran the story of qarun and haman
 
Zcvb
ZcvbZcvb
Zcvb
 
Daaaaaa
DaaaaaaDaaaaaa
Daaaaaa
 
8 habits of highly effective language learners
8 habits of highly effective language learners8 habits of highly effective language learners
8 habits of highly effective language learners
 

More from mfrancis

Eclipse Modeling Framework and plain OSGi the easy way - Mark Hoffman (Data I...
Eclipse Modeling Framework and plain OSGi the easy way - Mark Hoffman (Data I...Eclipse Modeling Framework and plain OSGi the easy way - Mark Hoffman (Data I...
Eclipse Modeling Framework and plain OSGi the easy way - Mark Hoffman (Data I...mfrancis
 
OSGi and Java 9+ - BJ Hargrave (IBM)
OSGi and Java 9+ - BJ Hargrave (IBM)OSGi and Java 9+ - BJ Hargrave (IBM)
OSGi and Java 9+ - BJ Hargrave (IBM)mfrancis
 
Simplify Web UX Coding using OSGi Modularity Magic - Paul Fraser (A2Z Living)
Simplify Web UX Coding using OSGi Modularity Magic - Paul Fraser (A2Z Living)Simplify Web UX Coding using OSGi Modularity Magic - Paul Fraser (A2Z Living)
Simplify Web UX Coding using OSGi Modularity Magic - Paul Fraser (A2Z Living)mfrancis
 
OSGi for the data centre - Connecting OSGi to Kubernetes - Frank Lyaruu
OSGi for the data centre - Connecting OSGi to Kubernetes - Frank LyaruuOSGi for the data centre - Connecting OSGi to Kubernetes - Frank Lyaruu
OSGi for the data centre - Connecting OSGi to Kubernetes - Frank Lyaruumfrancis
 
Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...
Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...
Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...mfrancis
 
OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...
OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...
OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...mfrancis
 
A real world use case with OSGi R7 - Jurgen Albert (Data In Motion Consulting...
A real world use case with OSGi R7 - Jurgen Albert (Data In Motion Consulting...A real world use case with OSGi R7 - Jurgen Albert (Data In Motion Consulting...
A real world use case with OSGi R7 - Jurgen Albert (Data In Motion Consulting...mfrancis
 
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)mfrancis
 
Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...
Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...
Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...mfrancis
 
OSGi CDI Integration Specification - Ray Augé (Liferay)
OSGi CDI Integration Specification - Ray Augé (Liferay)OSGi CDI Integration Specification - Ray Augé (Liferay)
OSGi CDI Integration Specification - Ray Augé (Liferay)mfrancis
 
How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...
How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...
How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...mfrancis
 
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...mfrancis
 
It Was Twenty Years Ago Today - Building an OSGi based Smart Home System - Ch...
It Was Twenty Years Ago Today - Building an OSGi based Smart Home System - Ch...It Was Twenty Years Ago Today - Building an OSGi based Smart Home System - Ch...
It Was Twenty Years Ago Today - Building an OSGi based Smart Home System - Ch...mfrancis
 
Popular patterns revisited on OSGi - Christian Schneider (Adobe)
Popular patterns revisited on OSGi - Christian Schneider (Adobe)Popular patterns revisited on OSGi - Christian Schneider (Adobe)
Popular patterns revisited on OSGi - Christian Schneider (Adobe)mfrancis
 
Integrating SLF4J and the new OSGi LogService 1.4 - BJ Hargrave (IBM)
Integrating SLF4J and the new OSGi LogService 1.4 - BJ Hargrave (IBM)Integrating SLF4J and the new OSGi LogService 1.4 - BJ Hargrave (IBM)
Integrating SLF4J and the new OSGi LogService 1.4 - BJ Hargrave (IBM)mfrancis
 
OSG(a)i: because AI needs a runtime - Tim Verbelen (imec)
OSG(a)i: because AI needs a runtime - Tim Verbelen (imec)OSG(a)i: because AI needs a runtime - Tim Verbelen (imec)
OSG(a)i: because AI needs a runtime - Tim Verbelen (imec)mfrancis
 
Flying to Jupiter with OSGi - Tony Walsh (ESA) & Hristo Indzhov (Telespazio V...
Flying to Jupiter with OSGi - Tony Walsh (ESA) & Hristo Indzhov (Telespazio V...Flying to Jupiter with OSGi - Tony Walsh (ESA) & Hristo Indzhov (Telespazio V...
Flying to Jupiter with OSGi - Tony Walsh (ESA) & Hristo Indzhov (Telespazio V...mfrancis
 
MicroProfile, OSGi was meant for this - Ray Auge (Liferay)
MicroProfile, OSGi was meant for this - Ray Auge (Liferay)MicroProfile, OSGi was meant for this - Ray Auge (Liferay)
MicroProfile, OSGi was meant for this - Ray Auge (Liferay)mfrancis
 
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...mfrancis
 
How to connect your OSGi application - Dirk Fauth (Bosch)
How to connect your OSGi application - Dirk Fauth (Bosch)How to connect your OSGi application - Dirk Fauth (Bosch)
How to connect your OSGi application - Dirk Fauth (Bosch)mfrancis
 

More from mfrancis (20)

Eclipse Modeling Framework and plain OSGi the easy way - Mark Hoffman (Data I...
Eclipse Modeling Framework and plain OSGi the easy way - Mark Hoffman (Data I...Eclipse Modeling Framework and plain OSGi the easy way - Mark Hoffman (Data I...
Eclipse Modeling Framework and plain OSGi the easy way - Mark Hoffman (Data I...
 
OSGi and Java 9+ - BJ Hargrave (IBM)
OSGi and Java 9+ - BJ Hargrave (IBM)OSGi and Java 9+ - BJ Hargrave (IBM)
OSGi and Java 9+ - BJ Hargrave (IBM)
 
Simplify Web UX Coding using OSGi Modularity Magic - Paul Fraser (A2Z Living)
Simplify Web UX Coding using OSGi Modularity Magic - Paul Fraser (A2Z Living)Simplify Web UX Coding using OSGi Modularity Magic - Paul Fraser (A2Z Living)
Simplify Web UX Coding using OSGi Modularity Magic - Paul Fraser (A2Z Living)
 
OSGi for the data centre - Connecting OSGi to Kubernetes - Frank Lyaruu
OSGi for the data centre - Connecting OSGi to Kubernetes - Frank LyaruuOSGi for the data centre - Connecting OSGi to Kubernetes - Frank Lyaruu
OSGi for the data centre - Connecting OSGi to Kubernetes - Frank Lyaruu
 
Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...
Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...
Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...
 
OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...
OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...
OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...
 
A real world use case with OSGi R7 - Jurgen Albert (Data In Motion Consulting...
A real world use case with OSGi R7 - Jurgen Albert (Data In Motion Consulting...A real world use case with OSGi R7 - Jurgen Albert (Data In Motion Consulting...
A real world use case with OSGi R7 - Jurgen Albert (Data In Motion Consulting...
 
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)
 
Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...
Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...
Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...
 
OSGi CDI Integration Specification - Ray Augé (Liferay)
OSGi CDI Integration Specification - Ray Augé (Liferay)OSGi CDI Integration Specification - Ray Augé (Liferay)
OSGi CDI Integration Specification - Ray Augé (Liferay)
 
How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...
How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...
How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...
 
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...
 
It Was Twenty Years Ago Today - Building an OSGi based Smart Home System - Ch...
It Was Twenty Years Ago Today - Building an OSGi based Smart Home System - Ch...It Was Twenty Years Ago Today - Building an OSGi based Smart Home System - Ch...
It Was Twenty Years Ago Today - Building an OSGi based Smart Home System - Ch...
 
Popular patterns revisited on OSGi - Christian Schneider (Adobe)
Popular patterns revisited on OSGi - Christian Schneider (Adobe)Popular patterns revisited on OSGi - Christian Schneider (Adobe)
Popular patterns revisited on OSGi - Christian Schneider (Adobe)
 
Integrating SLF4J and the new OSGi LogService 1.4 - BJ Hargrave (IBM)
Integrating SLF4J and the new OSGi LogService 1.4 - BJ Hargrave (IBM)Integrating SLF4J and the new OSGi LogService 1.4 - BJ Hargrave (IBM)
Integrating SLF4J and the new OSGi LogService 1.4 - BJ Hargrave (IBM)
 
OSG(a)i: because AI needs a runtime - Tim Verbelen (imec)
OSG(a)i: because AI needs a runtime - Tim Verbelen (imec)OSG(a)i: because AI needs a runtime - Tim Verbelen (imec)
OSG(a)i: because AI needs a runtime - Tim Verbelen (imec)
 
Flying to Jupiter with OSGi - Tony Walsh (ESA) & Hristo Indzhov (Telespazio V...
Flying to Jupiter with OSGi - Tony Walsh (ESA) & Hristo Indzhov (Telespazio V...Flying to Jupiter with OSGi - Tony Walsh (ESA) & Hristo Indzhov (Telespazio V...
Flying to Jupiter with OSGi - Tony Walsh (ESA) & Hristo Indzhov (Telespazio V...
 
MicroProfile, OSGi was meant for this - Ray Auge (Liferay)
MicroProfile, OSGi was meant for this - Ray Auge (Liferay)MicroProfile, OSGi was meant for this - Ray Auge (Liferay)
MicroProfile, OSGi was meant for this - Ray Auge (Liferay)
 
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
 
How to connect your OSGi application - Dirk Fauth (Bosch)
How to connect your OSGi application - Dirk Fauth (Bosch)How to connect your OSGi application - Dirk Fauth (Bosch)
How to connect your OSGi application - Dirk Fauth (Bosch)
 

Recently uploaded

Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 

Recently uploaded (20)

Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 

Java 8 modules, Jigsaw and OSGi - Neil Bartlett

  • 1. JAVA 8 MODULES, JIGSAW AND OSGi Neil Bartlett with Tim Ellison
  • 3. WHY MODULARISE THE JDK? • The JRE is monolithic • Download time and start-up time are directly affected by number of types available at runtime • Start-uptime includes a linear search through the class path to find system and application code • Oracle 1.7 Windows boot classpath nearly 20k classes • rt.jar index alone is approx 1Mb
  • 4. OSGi • If only Java had a module system that could help with that! • As we all know, OSGi will not be used for JDK modularity
  • 5. JIGSAW MOTIVATION • JRElibraries evolved organically and haphazardly over 13+ years • Many cyclic dependencies • Many weird/unexpected dependencies • E.g.: java.util is an incoherent mess • Splitting packages is unavoidable
  • 6. Good news, everyone! OSGi supports split packages, using Require- Bundle.
  • 7. SINGLE CLASSLOADER • Yeah but there’s the single classloader assumption... • Many parts of the JRE assume a single boot classloader • Package-private (“default”) accessibility requires whole packages in single classloader • Need to split packages across modules but not across classloaders • Break the one-to-one mapping of modules to classloaders
  • 8. OSGi supports shared classloaders, using Fragments.
  • 9. DEPENDENCY DIRECTION • Yeah, but the dependency goes in the “wrong” direction (fragment depends on host). • Jigsaw wants the “host” to depend on the “fragment”: host shouldn’t resolve if fragment unavailable.
  • 10. OSGi R4.3 supports that too using generic requirements/capabilities.
  • 11. REUSE • Yeahbut the fragment still depends on the host and cannot be used by other hosts.
  • 12. ...
  • 13. Pretty sure we could have supported this, if only you had talked to us.
  • 14. REFACTORING • Usual and best solution: move classes to the correct, most logical place • Obviously impossible in the JRE. •9 million Java developers (Sun estimate, 2009) and billions of apps depend on this library.
  • 16. MODULES • Module declared in module-info.java (module-info.class) • All new keywords are “scoped” module B @ 1.0 { ... }
  • 17. REQUIRES • Modules require other modules by name (and optionally, version) module B @ 1.0 { require A @ [2.0,3.0); }
  • 18. LOCAL • Requirements can be marked “local” • Target module is loaded in same classloader module B @ 1.0 { require local A @ [2.0,3.0); }
  • 19. EXPORTS • Modules list their exports, at package and type level • May include re-exported contents of required modules module B @ 1.0 { require A @ [2.0,3.0); export org.foo.ClassFoo; export org.bar.*; }
  • 20. FRIENDS • Modules can control which other modules require them • Compare with “friend” classes in C++ • N.B. permit clause is not versioned. module A @ 2.0 { permit B; }
  • 21. PROVIDES • Modules can logically “provide” other modules names • Compare with “virtual packages” in Debian • Supports substitution, but not refactoring (splits or joins) module com.ibm.stax @ 1.0 { provide jdk.stax @ 2.0; }
  • 22. ENTRY POINT • Modules can have a single entry-point class • Compare with Main-Class header in Jar manifests. module A @ 2.0 { permit B; class org.foo.Main; }
  • 23. VERSIONS • Modules will be versioned • Requirements use exact version or a range • No version semantics beyond ordering
  • 25. LIFECYCLE • Resolver solves dependencies in the face of multiple valid alternatives • OSGi resolver finds best fit for currently installed bundles at runtime • Jigsaw resolves during build and installation • Jigsaw has no dynamics, no module lifecycle
  • 26. METADATA • Tools required to inspect module-info.class • OSGi uses kind-of readable MANIFEST.MF
  • 27. COMPARISON • Whole-module dependencies and split packages are the biggest differences • Jigsaw will suffer all the same problems seen in OSGi with Require-Bundle (e.g. Eclipse Core Runtime refactoring mess) • While Jigsaw will technically achieve JDK modularity it will increase developer maintenance burden
  • 29. INTEROP • Both are here to stay... try to get the best of both worlds! • OSGi is established and will continue to be used widely • Jigsaw is underway and a key component of Java 8 • It need not be a zero-sum game
  • 30. JAVA 8 REQUIREMENTS • “It must be demonstrated by prototype to be feasible to modify an OSGi micro-kernel such that OSGi bundles running in that kernel can depend upon Java modules. The kernel must be able to load Java modules directly and resolve them using its own resolver, except for core system modules. Core system modules can only be loaded using the module system’s reification API.” • http://openjdk.java.net/projects/jigsaw/doc/draft-java-module- system-requirements-12
  • 31. PROJECT PENROSE • OpenJDK-hosted project to work on Jigsaw/OSGi interop • Project lead is Tim Ellison
  • 32. LEVELS 0 Tolerate 1 Understand 2 Exploit 3+ Cooperate
  • 33. LEVEL 0: TOLERATE • Ensure that OSGi frameworks continue to run unmodified on Jigsaw-enabled runtime. • Creating modules/bundles that have both Jigsaw and OSGi metadata on the same JAR.
  • 34. LEVEL 1: UNDERSTAND • Teach OSGi to read Jigsaw module info • Mapping Jigsaw metadata into OSGi concepts e.g. requires = Require-Bundle, exports = Export-Package. • Resolve Jigsaw modules using the OSGi resolver.
  • 35. LEVEL 2: EXPLOIT • OSGi implementation exploits Jigsaw modularity • E.g. use Jigsaw publication repositories.
  • 36. LEVEL 3+: COOPERATE •Ablend of OSGi and Jigsaw cross-delegation on module phases.
  • 37. ACHIEVEMENT 1 • Passed the OSGi tests on a Jigsaw-enabled runtime • Equinox 3.7, the OSGi Reference Implementation. • OSGi R4.3 Compliance Tests
  • 38. ACHIEVEMENT 2 • Run a Java application as either OSGi or Jigsaw modules • Took a Java 2D demo • Brokeinto multiple functional units, run demo as either OSGi bundles or Jigsaw modules
  • 39. GOAL 1 • Map Jigsaw module metadata to OSGi equivalents • Discussion: how to interpret Jigsaw directives
  • 40. GOAL 2 • Modify OSGi (Equinox) to use Jigsaw reification APIs • Load a 3rd-party module from the Jigsaw repository • Resolve it using the OSGi resolver
  • 41. TIMELINE • Java 8: summer 2013? Code freeze early 2013. • Jigsaw seems to be basically “done”, with little recent activity • No JSR yet, or perhaps ever. • If we need changes in Jigsaw, we need to push them soon.
  • 42. GET INVOLVED • Penrose home & mailing list: • http://openjdk.java.net/projects/penrose/ • Hg repository: • http://hg.openjdk.java.net/penrose/jigsaw/