Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 349997 - MBean container holds servlet reference
Summary: MBean container holds servlet reference
Status: RESOLVED FIXED
Alias: None
Product: Jetty
Classification: RT
Component: server (show other bugs)
Version: 7.4.2   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 7.2.x   Edit
Assignee: Michael Gorovoy CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-21 23:58 EDT by Greg Wilkins CLA
Modified: 2011-06-22 06:25 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.