[jboss-dev-forums] [Design of EJB 3.0] - Re: EJB3 Classloader Leak (EJBTHREE-1442)

bstansberry@jboss.com do-not-reply at jboss.com
Thu Sep 11 09:54:08 EDT 2008


"ALRubinger" wrote : So:
  | 
  | ejb3-connectors-jboss-beans.xml CL > Proxy Class > Business Interface Class > Deployment CL
  | 
  | ?
  | 
  | ...and that's how one CL creates a chain of linked references to the EJB_SLSB CL?

Yep, that's it.

anonymous wrote : I'd tried (unsuccessfully) to limit the alternate proxy creation before, which resulted in errors in web injection.

Can you elaborate on how it failed? The idea I had on http://www.jboss.com/index.html?module=bb&op=viewtopic&t=141165 of not creating the alternate proxy if the business interface class loaded by the TCCL is the same as the one loaded by the deployment classloader shouldn't have any impact if a version of the business interface class is available via the webapp's WEB-INF and the webapp is using a child-first classloader.  The classes wouldn't match and the code would drop into the code that creates the alternate proxy.

anonymous wrote : But probably using the TCCL ain't great either; I'll give it another spin. 

One thing that might help is to not use the TCCL to create the proxy; instead use the business interface class' classloader. Whereby this:


  | Set<Class<?>> businessInterfaces = new HashSet<Class<?>>();
  | businessInterfaces.add(businessInterfaceClass);
  | constructor = this.createProxyConstructor(businessInterfaces, tcl);

the last line becomes:

constructor = this.createProxyConstructor(businessInterfaces, businessInterfaceClass.getClassLoader());

This way the ref chain above is broken:

ejb3-connectors-jboss-beans.xml CL > Proxy Class > Business Interface Class > Deployment CL

becomes, in the case where the Deployment CL classes are visible to the TCCL:

Deployment CL > Proxy Class > Business Interface Class > Deployment CL

and in cases where a different version of the businessInterfaceClass is loaded from the TCCL:

Webapp CL > Proxy Class > Business Interface Class > Webapp CL

Neither of those two chains leak the Deployment CL -- at least not to anyplace where it isn't already leaked ;) 

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

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



More information about the jboss-dev-forums mailing list