[jboss-user] [Microcontainer] - Re: Locating the current DeploymentUnit

adrian@jboss.org do-not-reply at jboss.com
Mon Jun 8 09:27:04 EDT 2009


You can't use a thread local because 

1) the deployers/micrcontainer can cause other deployments/contexts to be processed
when dependencies are satisfied. e.g. deploying the transaction manager will cause
many other other services to start.

2) Outside the deployment framework callbacks there will be no "current deployment"

Also Classes don't necessarily belong to any deployment unit,
e.g. the bootstrap classes

I'd suggest the easiest way to implement this feature would be write a new deployer
that runs "post classlaoder". This would mainatain a map of
ClassLoader->DeploymentUnit
for any DeploymentUnit (including subdeployments like wars) that have a Module
attachment and hence their own classloader.

You can then use this map in whatever you want to do.

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

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



More information about the jboss-user mailing list