Your SlideShare is downloading. ×
0
杨泳JBoss senior software engineeryyang@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●   ...
What’s module?●   Module is a collection of functions to implement the    requirements of a specific domain, and can inter...
What’s runtime module?●   Different module needs separated classloader        –   Isolated module classloader without JAR ...
How JBoss-modules do?●   Implements a thread-safe,fast,and highly    concurrent module class loader model       –   ClassL...
Module ClassLoader●   Every module has its    classloader       –   Load local classes            and resources       –   ...
Module Structure●   Jar●   module.xml          –   name,version          –   resources          –   Dependencies          ...
Module name & version●   Module names are dot separated,a bit like package names or Maven    group Ids.Examples:          ...
Module Deployment structure●   Use modules as    module repo●   Name&version slot as    module directory●   put resources ...
API●   Custom your module loader extend    org.jboss.modules.ModuleLoader●   Load module on-flying and get their    classl...
Execute a module●   Execute a module from the repository       – which should have a main class          specified in its ...
JBoss-modules in AS7●   More than 200 modules●   Super fast bootstrap       –   Multi-threading loading       –   Lazy loa...
VS OSGi&JSR 277/294●   OSGi       –   Bootstrap wrapper VS Container       –   lightweight VS heavy               ●   Do o...
Future Directions●   Tooling       –   Make it easier to figure out needed and            missing dependencies(perhaps a  ...
Reference●   Get the sources at    http://github.com/jbossas/jboss-modules●   File issues at    https://issues.jboss.org/b...
DEMO●   Two modules with one has dependencies to    the other
Q&A杨泳 (yyang@redhat.com)JBoss senior software engineer
Upcoming SlideShare
Loading in...5
×

As7 jbug j_boss_modules_yang yong

583

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
583
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
6
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "As7 jbug j_boss_modules_yang yong"

  1. 1. 杨泳JBoss senior software engineeryyang@redhat.com
  2. 2. Agenda● What’s JBoss-Modules?● What’s Module?● How JBoss-Modules do?● Demo
  3. 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. 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. 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. 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. 7. Module ClassLoader● Every module has its classloader – Load local classes and resources – Delegate to other module classloader to load the dependencies
  8. 8. Module Structure● Jar● module.xml – name,version – resources – Dependencies – Main class
  9. 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. 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. 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. 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. 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. 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. 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. 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. 17. DEMO● Two modules with one has dependencies to the other
  18. 18. Q&A杨泳 (yyang@redhat.com)JBoss senior software engineer
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×