SlideShare a Scribd company logo
1 of 18
Download to read offline
杨泳
JBoss senior software engineer
yyang@redhat.com
Agenda

●   What’s JBoss-Modules?
●   What’s Module?
●   How JBoss-Modules do?
●   Demo
What’s JBoss-Modules

●   AS 7 bottom infrastructure
●   Load all AS7 libs, frameworks, containers,
    services by module
●   A simple APP loader, not a framework or
    container
        –   Implements a thread-safe,fast,and highly concurrent
              module class loader model
        –   Do one thing best
        –   No any dependecy
●   standalone.sh
        –   java –jar jboss-modules.jar -modulepath modules
              org.jboss.as.standalone
What’s module?
●   Module is a collection of functions to implement the
    requirements of a specific domain, and can interact with others
    by public interfaces.
●   Almost all products are made by module in various kind of
    industry
         –   Computer, Car
●   We also talk about modules in software industry
         –   user module, security module
         –   Care more module concept for Design & Development time,
               but in runtime:
                   ●   No isolation between JARs
                   ●   No protection from overlapping classes and packages
                   ●   No support of multiple versions
                   ●   No manageable dependencies(export/import)
                   ●   JAR HELL !!!
         –   How to ensure modules run as design?
                   ●   Need a module runtime environment!
What’s runtime module?
●   Different module needs separated classloader
        –   Isolated module classloader without JAR HELL
        –   Export only APIs which need to be exported
        –   Import only APIs which other module exports
●   JBoss-modules focus on runtime only
        –   No API or rule for Design&Dev time, not a library for
              development, not a framework, not a container
        –   Modules run in a separated environment expected in
             the Design&Development time
        –   Module can be developed by any other
             team/organization/ company
How JBoss-modules do?

●   Implements a thread-safe,fast,and highly
    concurrent module class loader model
       –   ClassLoader is the mechanism to separate application
             to modules in runtime
●   Manage module dependencies
●   Manage Imports and Exports
       –   Filter supported
Module ClassLoader

●   Every module has its
    classloader
       –   Load local classes
            and resources
       –   Delegate to other
            module
            classloader to
            load the
            dependencies
Module Structure

●   Jar
●   module.xml
          –   name,version
          –   resources
          –   Dependencies
          –   Main class
Module name & version
●   Module names are dot separated,a bit like package names or Maven
    group Ids.Examples:
          –   org.jboss.shrinkwrap.api
          –   org.apache.xalan
          –   org.dom4j
●   However there is no actual relationship between a module’s name and
    the names of the packages which comprise it
●



●   JBoss Modules does not support version resolution
●   Version slot allows two modules with the same name to coexist
    The version slot defaults to “main”
●   Fullname of a module
          –   org.jboss.shrinkwrap.api:main
          –   org.apache.xalan:main
          –   org.dom4j:main
Module Deployment structure
●   Use modules as
    module repo
●   Name&version slot as
    module directory
●   put resources and
    module.xml in the
    module directory
API

●   Custom your module loader extend
    org.jboss.modules.ModuleLoader
●   Load module on-flying and get their
    classloaders
       –   // Get my module loader
       –   ModuleLoader loader = ModuleLoader.forClass(getClass());
       –   // Load the module
       –   Module module = loader.loadModule(“com.widgets”);
       –   // Get its class loader
       –   ClassLoader classLoader = module.getClassLoader();
       –   // Load a class from it
       –   Class<?> c = Class.forName(“com.widgets.Widget”, true, classLoader);
Execute a module
●   Execute a module from the repository
       – which should have a main class
          specified in its module.xml descriptor


●   Java –jar jboss-modules.jar -modulepath
    modules org.foo.mymodule
JBoss-modules in AS7

●   More than 200 modules
●   Super fast bootstrap
       –   Multi-threading loading
       –   Lazy loading
●   Easily to develop your module to
    enhance AS7
●   Of course you can use jboss-modules as
    your application’s infrastructure
VS OSGi&JSR 277/294

●   OSGi
       –   Bootstrap wrapper VS Container
       –   lightweight VS heavy
               ●   Do one thing vs All in one
               ●   Easy to start
●   JSR 277/294 – Java Module System
       –   Stopped
       –   Jigsaw is a prototype module system intended
              for Java 8
       –   JBoss-modules will be compliant with Java
             Module System
Future Directions

●   Tooling
       –   Make it easier to figure out needed and
            missing dependencies(perhaps a
            modified version of Tattletale)
●   IDE integration
       –   Make it easier to run (and debug)
            modular code from within an IDE
Reference
●   Get the sources at
    http://github.com/jbossas/jboss-modules
●   File issues at
    https://issues.jboss.org/browse/MODULES
●   Read documentation at
    http://docs.jboss.org/jbossmodule
●   Discuss your ideas on irc.freenode.net:#jboss-
    modules
●   Chinese docs:
        –   http://jbosscn.iteye.com/
        –   http://www.bluedash.net/spaces/JBoss%20Module
              %E4%BB%8B%E7%BB%8D
DEMO

●   Two modules with one has dependencies to
    the other
Q&A




杨泳 (yyang@redhat.com)
JBoss senior software engineer

More Related Content

What's hot

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
 
Jigsaw - Javaforum 2015Q4
Jigsaw - Javaforum 2015Q4Jigsaw - Javaforum 2015Q4
Jigsaw - Javaforum 2015Q4
Rikard Thulin
 

What's hot (19)

Java 9 Jigsaw HackDay
Java 9 Jigsaw HackDayJava 9 Jigsaw HackDay
Java 9 Jigsaw HackDay
 
Java 1
Java 1Java 1
Java 1
 
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/)
 
Learn Java Part 1
Learn Java Part 1Learn Java Part 1
Learn Java Part 1
 
Java Course In Thane,Mumbai
Java Course In Thane,MumbaiJava Course In Thane,Mumbai
Java Course In Thane,Mumbai
 
Java modularity: life after Java 9
Java modularity: life after Java 9Java modularity: life after Java 9
Java modularity: life after Java 9
 
Java Virtual Machine (JVM), Difference JDK, JRE & JVM
Java Virtual Machine (JVM), Difference JDK, JRE & JVMJava Virtual Machine (JVM), Difference JDK, JRE & JVM
Java Virtual Machine (JVM), Difference JDK, JRE & JVM
 
02 java programming features of java i
02 java programming features of java  i02 java programming features of java  i
02 java programming features of java i
 
J2EE Struts with Hibernate Framework
J2EE Struts with Hibernate FrameworkJ2EE Struts with Hibernate Framework
J2EE Struts with Hibernate Framework
 
Jigsaw - Javaforum 2015Q4
Jigsaw - Javaforum 2015Q4Jigsaw - Javaforum 2015Q4
Jigsaw - Javaforum 2015Q4
 
Modular Java
Modular JavaModular Java
Modular Java
 
JDK,JRE,JVM
JDK,JRE,JVMJDK,JRE,JVM
JDK,JRE,JVM
 
Requirejs Demo - 2/14/12
Requirejs Demo - 2/14/12Requirejs Demo - 2/14/12
Requirejs Demo - 2/14/12
 
Java fundamentals
Java fundamentalsJava fundamentals
Java fundamentals
 
JAVA ENVIRONMENT
JAVA  ENVIRONMENTJAVA  ENVIRONMENT
JAVA ENVIRONMENT
 
Introduction to Java Programming
Introduction to Java Programming Introduction to Java Programming
Introduction to Java Programming
 
The Evolution of Java
The Evolution of JavaThe Evolution of Java
The Evolution of Java
 
Java Development Kit (jdk)
Java Development Kit (jdk)Java Development Kit (jdk)
Java Development Kit (jdk)
 
Java - At a glance
Java - At a glanceJava - At a glance
Java - At a glance
 

Viewers also liked

Guvnor presentation jervis liu
Guvnor presentation jervis liuGuvnor presentation jervis liu
Guvnor presentation jervis liu
jbossug
 
Jbug beijing 2011 rest easy introduction [兼容模式]
Jbug beijing 2011  rest easy introduction [兼容模式]Jbug beijing 2011  rest easy introduction [兼容模式]
Jbug beijing 2011 rest easy introduction [兼容模式]
jbossug
 

Viewers also liked (7)

Guvnor presentation jervis liu
Guvnor presentation jervis liuGuvnor presentation jervis liu
Guvnor presentation jervis liu
 
Jbug beijing 2011 rest easy introduction [兼容模式]
Jbug beijing 2011  rest easy introduction [兼容模式]Jbug beijing 2011  rest easy introduction [兼容模式]
Jbug beijing 2011 rest easy introduction [兼容模式]
 
20 Creative Sustainable Packaging Design Examples
20 Creative Sustainable Packaging Design Examples20 Creative Sustainable Packaging Design Examples
20 Creative Sustainable Packaging Design Examples
 
Essential things that should always be in your car
Essential things that should always be in your carEssential things that should always be in your car
Essential things that should always be in your car
 
The Near Future of CSS
The Near Future of CSSThe Near Future of CSS
The Near Future of CSS
 
Classroom Management Tips for Kids and Adolescents
Classroom Management Tips for Kids and AdolescentsClassroom Management Tips for Kids and Adolescents
Classroom Management Tips for Kids and Adolescents
 
32 Ways a Digital Marketing Consultant Can Help Grow Your Business
32 Ways a Digital Marketing Consultant Can Help Grow Your Business32 Ways a Digital Marketing Consultant Can Help Grow Your Business
32 Ways a Digital Marketing Consultant Can Help Grow Your Business
 

Similar to As7 jbug j_boss_modules_yang yong

Jax london 2011
Jax london 2011Jax london 2011
Jax london 2011
njbartlett
 
Calling all modularity solutions
Calling all modularity solutionsCalling all modularity solutions
Calling all modularity solutions
Sangjin Lee
 
Calling All Modularity Solutions: A Comparative Study from eBay
Calling All Modularity Solutions: A Comparative Study from eBayCalling All Modularity Solutions: A Comparative Study from eBay
Calling All Modularity Solutions: A Comparative Study from eBay
Tony Ng
 

Similar to As7 jbug j_boss_modules_yang yong (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
 
Jax london 2011
Jax london 2011Jax london 2011
Jax london 2011
 
Preparing for java 9 modules upload
Preparing for java 9 modules uploadPreparing for java 9 modules upload
Preparing for java 9 modules upload
 
JavaScript Module Loaders
JavaScript Module LoadersJavaScript Module Loaders
JavaScript Module Loaders
 
OpenJDK Penrose Presentation (JavaOne 2012)
OpenJDK Penrose Presentation (JavaOne 2012)OpenJDK Penrose Presentation (JavaOne 2012)
OpenJDK Penrose Presentation (JavaOne 2012)
 
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)
 
Java Platform Module System
Java Platform Module SystemJava Platform Module System
Java Platform Module System
 
Java SE 9 modules - an introduction (July 2018)
Java SE 9 modules - an introduction (July 2018)Java SE 9 modules - an introduction (July 2018)
Java SE 9 modules - an introduction (July 2018)
 
Java 9 Module System
Java 9 Module SystemJava 9 Module System
Java 9 Module System
 
Modules all the way down: OSGi and the Java Platform Module System
Modules all the way down: OSGi and the Java Platform Module SystemModules all the way down: OSGi and the Java Platform Module System
Modules all the way down: OSGi and the Java Platform Module System
 
Java8 - Under the hood
Java8 - Under the hoodJava8 - Under the hood
Java8 - Under the hood
 
Java9
Java9Java9
Java9
 
Java SE 9 modules (JPMS) - an introduction
Java SE 9 modules (JPMS) - an introductionJava SE 9 modules (JPMS) - an introduction
Java SE 9 modules (JPMS) - an introduction
 
Calling all modularity solutions
Calling all modularity solutionsCalling all modularity solutions
Calling all modularity solutions
 
Java 9 / Jigsaw - AJUG/VJUG session
Java 9 / Jigsaw - AJUG/VJUG  sessionJava 9 / Jigsaw - AJUG/VJUG  session
Java 9 / Jigsaw - AJUG/VJUG session
 
Calling All Modularity Solutions: A Comparative Study from eBay
Calling All Modularity Solutions: A Comparative Study from eBayCalling All Modularity Solutions: A Comparative Study from eBay
Calling All Modularity Solutions: A Comparative Study from eBay
 
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)
 
Kernel module programming
Kernel module programmingKernel module programming
Kernel module programming
 
Require.JS
Require.JSRequire.JS
Require.JS
 
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
 

Recently uploaded

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 

As7 jbug j_boss_modules_yang yong

  • 1. 杨泳 JBoss senior software engineer yyang@redhat.com
  • 2. Agenda ● What’s JBoss-Modules? ● What’s Module? ● How JBoss-Modules do? ● Demo
  • 3. What’s JBoss-Modules ● AS 7 bottom infrastructure ● Load all AS7 libs, frameworks, containers, services by module ● A simple APP loader, not a framework or container – Implements a thread-safe,fast,and highly concurrent module class loader model – Do one thing best – No any dependecy ● standalone.sh – java –jar jboss-modules.jar -modulepath modules org.jboss.as.standalone
  • 4. What’s module? ● Module is a collection of functions to implement the requirements of a specific domain, and can interact with others by public interfaces. ● Almost all products are made by module in various kind of industry – Computer, Car ● We also talk about modules in software industry – user module, security module – Care more module concept for Design & Development time, but in runtime: ● No isolation between JARs ● No protection from overlapping classes and packages ● No support of multiple versions ● No manageable dependencies(export/import) ● JAR HELL !!! – How to ensure modules run as design? ● Need a module runtime environment!
  • 5. What’s runtime module? ● Different module needs separated classloader – Isolated module classloader without JAR HELL – Export only APIs which need to be exported – Import only APIs which other module exports ● JBoss-modules focus on runtime only – No API or rule for Design&Dev time, not a library for development, not a framework, not a container – Modules run in a separated environment expected in the Design&Development time – Module can be developed by any other team/organization/ company
  • 6. How JBoss-modules do? ● Implements a thread-safe,fast,and highly concurrent module class loader model – ClassLoader is the mechanism to separate application to modules in runtime ● Manage module dependencies ● Manage Imports and Exports – Filter supported
  • 7. Module ClassLoader ● Every module has its classloader – Load local classes and resources – Delegate to other module classloader to load the dependencies
  • 8. Module Structure ● Jar ● module.xml – name,version – resources – Dependencies – Main class
  • 9. Module name & version ● Module names are dot separated,a bit like package names or Maven group Ids.Examples: – org.jboss.shrinkwrap.api – org.apache.xalan – org.dom4j ● However there is no actual relationship between a module’s name and the names of the packages which comprise it ● ● JBoss Modules does not support version resolution ● Version slot allows two modules with the same name to coexist The version slot defaults to “main” ● Fullname of a module – org.jboss.shrinkwrap.api:main – org.apache.xalan:main – org.dom4j:main
  • 10. Module Deployment structure ● Use modules as module repo ● Name&version slot as module directory ● put resources and module.xml in the module directory
  • 11. API ● Custom your module loader extend org.jboss.modules.ModuleLoader ● Load module on-flying and get their classloaders – // Get my module loader – ModuleLoader loader = ModuleLoader.forClass(getClass()); – // Load the module – Module module = loader.loadModule(“com.widgets”); – // Get its class loader – ClassLoader classLoader = module.getClassLoader(); – // Load a class from it – Class<?> c = Class.forName(“com.widgets.Widget”, true, classLoader);
  • 12. Execute a module ● Execute a module from the repository – which should have a main class specified in its module.xml descriptor ● Java –jar jboss-modules.jar -modulepath modules org.foo.mymodule
  • 13. JBoss-modules in AS7 ● More than 200 modules ● Super fast bootstrap – Multi-threading loading – Lazy loading ● Easily to develop your module to enhance AS7 ● Of course you can use jboss-modules as your application’s infrastructure
  • 14. VS OSGi&JSR 277/294 ● OSGi – Bootstrap wrapper VS Container – lightweight VS heavy ● Do one thing vs All in one ● Easy to start ● JSR 277/294 – Java Module System – Stopped – Jigsaw is a prototype module system intended for Java 8 – JBoss-modules will be compliant with Java Module System
  • 15. Future Directions ● Tooling – Make it easier to figure out needed and missing dependencies(perhaps a modified version of Tattletale) ● IDE integration – Make it easier to run (and debug) modular code from within an IDE
  • 16. Reference ● Get the sources at http://github.com/jbossas/jboss-modules ● File issues at https://issues.jboss.org/browse/MODULES ● Read documentation at http://docs.jboss.org/jbossmodule ● Discuss your ideas on irc.freenode.net:#jboss- modules ● Chinese docs: – http://jbosscn.iteye.com/ – http://www.bluedash.net/spaces/JBoss%20Module %E4%BB%8B%E7%BB%8D
  • 17. DEMO ● Two modules with one has dependencies to the other