[jboss-dev-forums] [JBoss Microcontainer Development] - Re: Testing Deployers with new Reflect + ClassPool

flavia.rainone@jboss.com do-not-reply at jboss.com
Thu Nov 12 13:08:53 EST 2009


"alesj" wrote : But you should make it in such way that you can do proper cleanup with Module only.
  | 
  | e.g.
  | With register code you create hierarchy with Module's help, but also apply proper CL mappings.
  | Where you somehow tie those CL mappings with Module.
  | (perhaps a simple WeakHashMap by CL key is enough here)
  | But the real cleanup code is done by Module mapping.
  | 

Those CL mappings are already tied with Module. What I currently lack is a map from Modules to ClassPools. I guess I'll create a JBossClDelegatingCPRepository (BTW, maybe we should refactor those names?) and add a unregister(ClassLoader, Module) like the one below:
public void unregisterClassLoader(ClassLoader classLoader, Module module){
  | ClassPool classPool = registeredModules.remove(module); // remove from the newly created map module->classpool
  | if (classLoader == null)
  |      classPool.close(); // perform CP cleanup
  | else
  |      this.unregisterClassLoader(classLoader); // needs to call the original unregister module so
  | // that the registeredCLs mapping is cleaned up as well; this method also invokes classPool.close()
  | // and this should not be done twice
  | }

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

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



More information about the jboss-dev-forums mailing list