The Leak Suspect report tries to display the current activity of a suspicious thread. For example, a HTTP worker thread used by a web container usually contains information about the request URL currently processed. This information is helpful to better understand the current problem.
This is how it works: The heap dump contains information about which objects are currently on the call stack of a thread (so called "Java Locals"). If some "HTTP request" object is on the call stack, one can pretty safely assume that the thread is executing this HTTP request. Of course, this requires some implementation knowlege and may change from version to version. The Memory Analyzer checks if a request details resolver is configured for one of the Java local objects and asks the resolver to provide a summary and detail page.
<!ELEMENT extension (resolver)+>
<!ATTLIST extension
point CDATA #REQUIRED
id CDATA #IMPLIED
name CDATA #IMPLIED
><!ELEMENT resolver EMPTY>
<!ATTLIST resolver
impl CDATA #REQUIRED
>
<extension point="org.eclipse.mat.api.requestResolver"> <resolver impl="org.eclipse.mat.inspections.jetty.JettyRequestResolver"/> </extension>The implemenation could look like this:
@Subject("org.mortbay.jetty.Request")
public class JettyRequestResolver implements IRequestDetailsResolver
{
public void complement(ISnapshot snapshot,
IThreadInfo thread,
int[] javaLocals,
int thisJavaLocal,
IProgressListener listener)
throws SnapshotException
{
IObject httpRequest = snapshot.getObject(thisJavaLocal);
IObject requestURI = (IObject) httpRequest.resolveValue("_requestURI");
[...]
thread.addRequest(summary, details);
}
The @Subject tells the Memory Analyzer, to use this request details
resolver for all instances of type "org.mortbay.jetty.Request". In this
Copyright (c) 2008 SAP AG and others.
All rights reserved. This program and the accompanying materials are made
available under the terms of the Eclipse Public License 2.0 which
accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-2.0/