SlideShare a Scribd company logo
1 of 32
Download to read offline
@aalmiray | andresalmiray.com
Building modular
applications with JPMS
and Layrry
Andres
Almiray
Seasoned Sourceror

@ Oracle

Apache Groovy PMC

Java Champion

Hackergarten

github.com/aalmiray
@aalmiray | andresalmiray.com
JPMS
• Java Platform Module System (also known as Jigsaw)

• Introduced in Java 9

• Designed to break down the JVM monolith

• Applicable to user space as well

• The promise is to give developers better code
encapsulation and design foundations
@aalmiray | andresalmiray.com
However …
@aalmiray | andresalmiray.com
Some user statements
• JPMS only allows for one version of a module

• JPMS doesn’t allow adding modules at runtime

• I have to modularize ALL dependencies to reap the
benefits of JPMS

• It’s so hard to map dependency coordinates to module
dependencies

• Help, non-exported packages of different modules collide!
@aalmiray | andresalmiray.com
What no one ever said
“Let’s use JPMS Layers to
tackle (some of) these issues”
https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/ModuleLayer.html
@aalmiray | andresalmiray.com
Using the Layers API
@aalmiray | andresalmiray.com
https://github.com/
moditect/layrry/
Gunnar
Morling
Open Source Software
Engineer

@ RedHat

Java Champion

Lead of Debezium

Bean Validation 2.0 Spec Lead

morling.dev
@aalmiray | andresalmiray.com
Hello Layrry!
Layrry
JPMS
Launch!
YAML sucks!
TOML rocks!
Plugin Architectures
1 package org.moditect.layrry.platform;
2
3 /**
4 * Implementations get notified about the
5 * addition or removal of plug-in layers.
6 * Retrieved via the service loader API.
7 */
8 public interface PluginLifecycleListener {
9
10 void pluginAdded(PluginDescriptor plugin);
11
12 void pluginRemoved(PluginDescriptor plugin);
13 }
1 @Override
2 public void pluginAdded(PluginDescriptor plugin) {
3 ServiceLoader<MyService> services = ServiceLoader.load(
4 plugin.getModuleLayer(), MyService.class);
5
6 services.forEach(service -> {
7 // only process services declared by the added layer itself,
8 // but not from ancestor layers
9 if (service.getClass().getModule().getLayer() == layer) {
10 // process service ...
11 }
12 });
13 }
Parameterization
layrry-launcher-1.0-SNAPSHOT-all.jar 
—layers-config javafx.toml 
—properties versions.properties
@aalmiray | andresalmiray.com
Launch options
• Use the ready made launcher from the command line.

• Build your custom launcher.

• Or …
jbang layrry@moditect 
—layers-config javafx.toml 
—properties versions.properties
DEMO
@aalmiray | andresalmiray.com
Future
• Support remote configuration (?)

• Ready made binary distributions

• Distribution channels

• Github releases

• Homebrew (?)

•
@aalmiray | andresalmiray.com
Resources
• https://www.morling.dev/blog/introducing-layrry-runner-
and-api-for-modularized-java-applications/

• https://www.morling.dev/blog/plugin-architectures-with-
layrry-and-the-java-module-system/

• https://www.morling.dev/blog/class-unloading-in-layered-
java-applications/

• https://github.com/moditect/layrry/

• https://github.com/moditect/layrry-examples/
@aalmiray | andresalmiray.com

More Related Content

What's hot

What's hot (20)

Rails Engine | Modular application
Rails Engine | Modular applicationRails Engine | Modular application
Rails Engine | Modular application
 
Play! Framework for JavaEE Developers
Play! Framework for JavaEE DevelopersPlay! Framework for JavaEE Developers
Play! Framework for JavaEE Developers
 
Tales from the OSGi trenches
Tales from the OSGi trenchesTales from the OSGi trenches
Tales from the OSGi trenches
 
Laravel Introduction
Laravel IntroductionLaravel Introduction
Laravel Introduction
 
Maven Introduction
Maven IntroductionMaven Introduction
Maven Introduction
 
Liferay maven sdk
Liferay maven sdkLiferay maven sdk
Liferay maven sdk
 
Projects In Laravel : Learn Laravel Building 10 Projects
Projects In Laravel : Learn Laravel Building 10 ProjectsProjects In Laravel : Learn Laravel Building 10 Projects
Projects In Laravel : Learn Laravel Building 10 Projects
 
Web application development using Play Framework (with Java)
Web application development using Play Framework (with Java)Web application development using Play Framework (with Java)
Web application development using Play Framework (with Java)
 
Agile sites @ telmore
Agile sites @ telmore Agile sites @ telmore
Agile sites @ telmore
 
Workshop Framework(J2EE/OSGi/RCP)
Workshop Framework(J2EE/OSGi/RCP)Workshop Framework(J2EE/OSGi/RCP)
Workshop Framework(J2EE/OSGi/RCP)
 
Rails Engine Patterns
Rails Engine PatternsRails Engine Patterns
Rails Engine Patterns
 
Agile sites2
Agile sites2Agile sites2
Agile sites2
 
Laravel and CodeIgniter: pros & cons
Laravel and CodeIgniter: pros & consLaravel and CodeIgniter: pros & cons
Laravel and CodeIgniter: pros & cons
 
Introduction to Play Framework
Introduction to Play FrameworkIntroduction to Play Framework
Introduction to Play Framework
 
Play Framework and Activator
Play Framework and ActivatorPlay Framework and Activator
Play Framework and Activator
 
Intro to Laravel
Intro to LaravelIntro to Laravel
Intro to Laravel
 
Introduction to Servlets
Introduction to ServletsIntroduction to Servlets
Introduction to Servlets
 
Managing an OSGi Framework with Apache Felix Web Console
Managing an OSGi Framework with  Apache Felix Web ConsoleManaging an OSGi Framework with  Apache Felix Web Console
Managing an OSGi Framework with Apache Felix Web Console
 
Agile sites311training
Agile sites311trainingAgile sites311training
Agile sites311training
 
FITC - Here Be Dragons: Advanced JavaScript Debugging
FITC - Here Be Dragons: Advanced JavaScript DebuggingFITC - Here Be Dragons: Advanced JavaScript Debugging
FITC - Here Be Dragons: Advanced JavaScript Debugging
 

Similar to Building modular applications with JPMS and Layrry

Cannibalising The Google App Engine
Cannibalising The  Google  App  EngineCannibalising The  Google  App  Engine
Cannibalising The Google App Engine
catherinewall
 
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx PluginGr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
Yasuharu Nakano
 

Similar to Building modular applications with JPMS and Layrry (20)

Java Servlets & JSP
Java Servlets & JSPJava Servlets & JSP
Java Servlets & JSP
 
Cannibalising The Google App Engine
Cannibalising The  Google  App  EngineCannibalising The  Google  App  Engine
Cannibalising The Google App Engine
 
Liberty Deep Dive
Liberty Deep DiveLiberty Deep Dive
Liberty Deep Dive
 
Cloud Platforms for Java
Cloud Platforms for JavaCloud Platforms for Java
Cloud Platforms for Java
 
jdays 2015
jdays 2015jdays 2015
jdays 2015
 
Preparing for java 9 modules upload
Preparing for java 9 modules uploadPreparing for java 9 modules upload
Preparing for java 9 modules upload
 
Introduction to Lagom Framework
Introduction to Lagom FrameworkIntroduction to Lagom Framework
Introduction to Lagom Framework
 
Titanium appcelerator best practices
Titanium appcelerator best practicesTitanium appcelerator best practices
Titanium appcelerator best practices
 
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx PluginGr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
 
A Journey through the JDKs (Java 9 to Java 11)
A Journey through the JDKs (Java 9 to Java 11)A Journey through the JDKs (Java 9 to Java 11)
A Journey through the JDKs (Java 9 to Java 11)
 
Automated integration testing of distributed systems with Docker Compose and ...
Automated integration testing of distributed systems with Docker Compose and ...Automated integration testing of distributed systems with Docker Compose and ...
Automated integration testing of distributed systems with Docker Compose and ...
 
Code One 2018 maven
Code One 2018   mavenCode One 2018   maven
Code One 2018 maven
 
LausanneJUG 2017 - Jigsaw est prêt à tuer le classpath
LausanneJUG 2017 - Jigsaw est prêt à tuer le classpathLausanneJUG 2017 - Jigsaw est prêt à tuer le classpath
LausanneJUG 2017 - Jigsaw est prêt à tuer le classpath
 
Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010
Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010
Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010
 
OSGi Cloud Ecosystems - David Bosschaert
OSGi Cloud Ecosystems - David BosschaertOSGi Cloud Ecosystems - David Bosschaert
OSGi Cloud Ecosystems - David Bosschaert
 
Mule meetup 25thjan
Mule meetup 25thjanMule meetup 25thjan
Mule meetup 25thjan
 
Mastering the Sling Rewriter by Justin Edelson
Mastering the Sling Rewriter by Justin EdelsonMastering the Sling Rewriter by Justin Edelson
Mastering the Sling Rewriter by Justin Edelson
 
Mastering the Sling Rewriter
Mastering the Sling RewriterMastering the Sling Rewriter
Mastering the Sling Rewriter
 
ScalaUA - distage: Staged Dependency Injection
ScalaUA - distage: Staged Dependency InjectionScalaUA - distage: Staged Dependency Injection
ScalaUA - distage: Staged Dependency Injection
 
Java modularity: life after Java 9
Java modularity: life after Java 9Java modularity: life after Java 9
Java modularity: life after Java 9
 

More from Andres Almiray

More from Andres Almiray (20)

Creando, creciendo, y manteniendo una comunidad de codigo abierto
Creando, creciendo, y manteniendo una comunidad de codigo abiertoCreando, creciendo, y manteniendo una comunidad de codigo abierto
Creando, creciendo, y manteniendo una comunidad de codigo abierto
 
Liberando a produccion con confianza
Liberando a produccion con confianzaLiberando a produccion con confianza
Liberando a produccion con confianza
 
Liberando a produccion con confidencia
Liberando a produccion con confidenciaLiberando a produccion con confidencia
Liberando a produccion con confidencia
 
OracleDB Ecosystem for Java Developers
OracleDB Ecosystem for Java DevelopersOracleDB Ecosystem for Java Developers
OracleDB Ecosystem for Java Developers
 
Softcon.ph - Maven Puzzlers
Softcon.ph - Maven PuzzlersSoftcon.ph - Maven Puzzlers
Softcon.ph - Maven Puzzlers
 
Maven Puzzlers
Maven PuzzlersMaven Puzzlers
Maven Puzzlers
 
Oracle Database Ecosystem for Java Developers
Oracle Database Ecosystem for Java DevelopersOracle Database Ecosystem for Java Developers
Oracle Database Ecosystem for Java Developers
 
JReleaser - Releasing at the speed of light
JReleaser - Releasing at the speed of lightJReleaser - Releasing at the speed of light
JReleaser - Releasing at the speed of light
 
Going Reactive with g rpc
Going Reactive with g rpcGoing Reactive with g rpc
Going Reactive with g rpc
 
What I wish I knew about Maven years ago
What I wish I knew about Maven years agoWhat I wish I knew about Maven years ago
What I wish I knew about Maven years ago
 
The impact of sci fi in tech
The impact of sci fi in techThe impact of sci fi in tech
The impact of sci fi in tech
 
Gradle Ex Machina - Devoxx 2019
Gradle Ex Machina - Devoxx 2019Gradle Ex Machina - Devoxx 2019
Gradle Ex Machina - Devoxx 2019
 
Interacting with the Oracle Cloud Java SDK with Gradle
Interacting with the Oracle Cloud Java SDK with GradleInteracting with the Oracle Cloud Java SDK with Gradle
Interacting with the Oracle Cloud Java SDK with Gradle
 
Gradle ex-machina
Gradle ex-machinaGradle ex-machina
Gradle ex-machina
 
Go Java, Go!
Go Java, Go!Go Java, Go!
Go Java, Go!
 
Going Reactive with gRPC
Going Reactive with gRPCGoing Reactive with gRPC
Going Reactive with gRPC
 
The JavaFX Ecosystem
The JavaFX EcosystemThe JavaFX Ecosystem
The JavaFX Ecosystem
 
Understanding Reactive Programming
Understanding Reactive ProgrammingUnderstanding Reactive Programming
Understanding Reactive Programming
 
Spock's New Tricks
Spock's New TricksSpock's New Tricks
Spock's New Tricks
 
Go Java, Go!
Go Java, Go!Go Java, Go!
Go Java, Go!
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Recently uploaded (20)

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

Building modular applications with JPMS and Layrry