[jboss-user] [Microcontainer] - Re: Blog post about deployers

adrian@jboss.org do-not-reply at jboss.com
Tue Sep 23 12:23:02 EDT 2008


PHILOSOPHY

I'd say you mostly got it correct Bob.
The part you are missing is actually the most important part.

The Deployers create components, i.e. metadata for MBeans and POJOs
(or other component models).
They don't directly create anything, deployers are about MetaData processing.

Instead it is the Microcontainer that creates the runtime objects from this
component metadata when their dependencies are satisfied.

CLASSLOADING

The "magic" that occurs in the ClassLoader part is because it is doing
"two stage" deployment.

The DESCRIBE stage populates the ClassLoading system to say what classloaders you
want to construct - ClassLoadingMetaData).
This includes any dependencies (similar to OSGi)

e.g. My deployment needs version 1.0 of the com.acme.foo package.
META-INF/jboss-classloading.xml

  | <classloading xmlns="urn:jboss:classloading:1.0">
  |    <requirements>
  |       <package name="com.acme.foo" version="1.0"/>
  |    </requirements>
  | </classloading>
  | 

Only when that dependency is satisfied (thanks to some more "magic" in
the microcontainer :-) will it allow your deployment to move to the CLASSLOADER stage.

Of course, the CLASSLOADER stage actually creates the classloader
and wires together the related deployments so your deployment can see
the requested modules/packages.

WAR CLASSLOADING

The WEB classloader is probably the most complicated,
so it was probably a bad example for a simple explanation. :-)

In general, the ClassLoadingMetaData comes from three different places.
1) META-INF/jboss-classloading.xml (PARSE STAGE)
2) A specific deployer for the deployment type (POST PARSE)
3) The ClassLoadingDefaultDeployer (DESCRIBE)

For a WAR we have to do special things. WARs get their own classloader
that does "servlet spec" classloading, i.e. parent last,
hence the WARClassLoaderDeployer. This is true whether the WAR is a top
level deployment or a part of another archive, e.g. an EAR

For other deployments the ClassLoadingDefaultDeployer just
creates a simple "standard" classloader for the whole deployment (if you don't describe
it explicitly using the xml).

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4178372#4178372

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4178372



More information about the jboss-user mailing list