SlideShare a Scribd company logo
杨泳
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

KEY
Modularization in java 8
PDF
Moving From Plexus To Guice
ODP
Projects in Enterprise Java (Java EE)
PPTX
Java modularization
ODP
Web development in JavaEE7 with JSF, does it still matter?
PDF
CodeCamp Iasi 10 march 2012 - SolvingThePuzzle
PPTX
QSpiders - Jdk Jvm Jre and Jit
PDF
Basic difference between jdk,jre,jvm in advance java course
Modularization in java 8
Moving From Plexus To Guice
Projects in Enterprise Java (Java EE)
Java modularization
Web development in JavaEE7 with JSF, does it still matter?
CodeCamp Iasi 10 march 2012 - SolvingThePuzzle
QSpiders - Jdk Jvm Jre and Jit
Basic difference between jdk,jre,jvm in advance java course

What's hot (18)

PDF
Java 9 Jigsaw HackDay
PPTX
PPTX
Modularity of The Java Platform Javaday (http://javaday.org.ua/)
PDF
Learn Java Part 1
PPTX
Java Course In Thane,Mumbai
PDF
Java modularity: life after Java 9
PPTX
Java Virtual Machine (JVM), Difference JDK, JRE & JVM
PDF
02 java programming features of java i
PPTX
J2EE Struts with Hibernate Framework
PDF
Jigsaw - Javaforum 2015Q4
PPTX
Modular Java
DOCX
JDK,JRE,JVM
KEY
Requirejs Demo - 2/14/12
PPTX
Java fundamentals
PPTX
JAVA ENVIRONMENT
PPTX
Introduction to Java Programming
ODP
The Evolution of Java
PDF
Java - At a glance
Java 9 Jigsaw HackDay
Modularity of The Java Platform Javaday (http://javaday.org.ua/)
Learn Java Part 1
Java Course In Thane,Mumbai
Java modularity: life after Java 9
Java Virtual Machine (JVM), Difference JDK, JRE & JVM
02 java programming features of java i
J2EE Struts with Hibernate Framework
Jigsaw - Javaforum 2015Q4
Modular Java
JDK,JRE,JVM
Requirejs Demo - 2/14/12
Java fundamentals
JAVA ENVIRONMENT
Introduction to Java Programming
The Evolution of Java
Java - At a glance
Ad

Viewers also liked (7)

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

Similar to As7 jbug j_boss_modules_yang yong (20)

PDF
Jax london 2011
PDF
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
PPTX
Preparing for java 9 modules upload
PPTX
JavaScript Module Loaders
PDF
OpenJDK Penrose Presentation (JavaOne 2012)
PPTX
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)
PPTX
Java Platform Module System
PDF
Java SE 9 modules - an introduction (July 2018)
PPT
Java 9 Module System
PDF
Modules all the way down: OSGi and the Java Platform Module System
PPT
Java8 - Under the hood
PDF
Java SE 9 modules (JPMS) - an introduction
PDF
Calling all modularity solutions
PDF
Java 9 / Jigsaw - AJUG/VJUG session
PDF
Calling All Modularity Solutions: A Comparative Study from eBay
PPTX
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
PPT
Kernel module programming
PDF
Require.JS
PPTX
S/W Design and Modularity using Maven
Jax london 2011
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
Preparing for java 9 modules upload
JavaScript Module Loaders
OpenJDK Penrose Presentation (JavaOne 2012)
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)
Java Platform Module System
Java SE 9 modules - an introduction (July 2018)
Java 9 Module System
Modules all the way down: OSGi and the Java Platform Module System
Java8 - Under the hood
Java SE 9 modules (JPMS) - an introduction
Calling all modularity solutions
Java 9 / Jigsaw - AJUG/VJUG session
Calling All Modularity Solutions: A Comparative Study from eBay
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Kernel module programming
Require.JS
S/W Design and Modularity using Maven

Recently uploaded (20)

PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Sports Quiz easy sports quiz sports quiz
PPTX
Pharma ospi slides which help in ospi learning
PDF
Computing-Curriculum for Schools in Ghana
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Classroom Observation Tools for Teachers
PPTX
master seminar digital applications in india
PDF
Insiders guide to clinical Medicine.pdf
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
RMMM.pdf make it easy to upload and study
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
2.FourierTransform-ShortQuestionswithAnswers.pdf
Microbial disease of the cardiovascular and lymphatic systems
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Sports Quiz easy sports quiz sports quiz
Pharma ospi slides which help in ospi learning
Computing-Curriculum for Schools in Ghana
Final Presentation General Medicine 03-08-2024.pptx
Classroom Observation Tools for Teachers
master seminar digital applications in india
Insiders guide to clinical Medicine.pdf
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
RMMM.pdf make it easy to upload and study
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
human mycosis Human fungal infections are called human mycosis..pptx
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Abdominal Access Techniques with Prof. Dr. R K Mishra

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