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#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...