[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Module.getModuleForClassLoader()
kabir.khan@jboss.com
do-not-reply at jboss.com
Mon Jan 26 10:40:59 EST 2009
"adrian at jboss.org" wrote :
| What is different between that and using the bootstrap if you are asking the question
| part way through the bootstrap process?
|
The Bootstrap implementations are invoked AFTER the bootstrap deployments are deployed, so all the classloaders have been created. AbstractServerImpl:
| public void start() throws IllegalStateException, Exception
| {
| ...
| // deploys conf/bootstrap.xml and conf/bootstrap/*.xml
| doStart(watch);
|
| // TODO Fix the TCL hack used here!
| ClassLoader cl = Thread.currentThread().getContextClassLoader();
| try
| {
| // Run the bootstraps
| for (Bootstrap bootstrap : bootstraps)
| {
| Thread.currentThread().setContextClassLoader(bootstrap.getClass().getClassLoader());
| startedBootstraps.add(0, bootstrap);
| bootstrap.start(this);
| }
| }
| finally
| {
| Thread.currentThread().setContextClassLoader(cl);
| }
| ...
| }
|
"adrian at jboss.org" wrote :
| Maybe a better mechanism would be to use the in/uncallback to be notified of the Modules
| as they are constructed/destroyed.
|
Why is that better? I'm happy with using bootstrap, as long as the following is ok:
- use KernelDeployment.getClassLoader() to get classloader name and look that up in MC
- use ClassLoading.getModuleForClassLoader() to get the module corresponding to the classloader rather than the findModule() stuff from my workaround example
If I have understood correctly, using a bootstrap I only need to modify aop.xml, making it easy to upgrade older versions of AS. Otherwise I need to modify classloader.xml to add the in/uncallback stuff. Will that work when the classes I need are in the aop classloader that has not been deployed yet? If I add the un/incallback in aop.xml, is that retroactive, i.e. will classloaders added previously in the bootstrap process (from classloader.xml) be added?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4204740#4204740
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4204740
More information about the jboss-dev-forums
mailing list