Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 349997

Summary: MBean container holds servlet reference
Product: [RT] Jetty Reporter: Greg Wilkins <gregw>
Component: serverAssignee: Michael Gorovoy <mgorovoy>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: gunnar, jetty-inbox, odi
Version: 7.4.2   
Target Milestone: 7.2.x   
Hardware: All   
OS: All   
Whiteboard:

Description Greg Wilkins CLA 2011-06-21 23:58:08 EDT
Ortwin Glück to jetty-dev
	
Hi,

I have found that:

WebAppContext app = new WebAppContext();
app.setContextPath(context);
app.setWar(warFile);
app.setClassLoader(new MyWebAppClassLoader(cl, app));
jetty.getHandler().addHandler(app);

app.stop();
jetty.getHandler().removeHandler(app);
app.destroy();

doesn't allow the webapp to be GCed if JMX is enabled.

The reason is that the MBeanContainer still has Container.Relationship
objects to the ServletHolders.

Ortwin
Comment 1 Greg Wilkins CLA 2011-06-22 01:08:10 EDT
fixed in r3411

MBeanContainer now uses entirely weak references.

Michael can you double check this one and see that redeploying a webapplication does allow the servlets to be collected.
Comment 2 Ortwin Glück CLA 2011-06-22 06:25:58 EDT
I think Target Milestone should be 7.4.3.