improved debugging dumps
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2625 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
fd08937fab
commit
68323125b6
|
@ -320,6 +320,11 @@ public class MBeanContainer extends AbstractLifeCycle implements Container.Liste
|
|||
{
|
||||
out.append(toString()).append("\n");
|
||||
AggregateLifeCycle.dump(out,indent,_beans.entrySet());
|
||||
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public String dump()
|
||||
{
|
||||
return AggregateLifeCycle.dump(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
Dumpable: Dumpable Object
|
||||
dump():Object:INFO:Dump the nested Object state as a String
|
|
@ -21,6 +21,7 @@ import java.net.URL;
|
|||
import java.net.URLClassLoader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.EventListener;
|
||||
|
@ -61,6 +62,8 @@ import org.eclipse.jetty.util.LazyList;
|
|||
import org.eclipse.jetty.util.Loader;
|
||||
import org.eclipse.jetty.util.TypeUtil;
|
||||
import org.eclipse.jetty.util.URIUtil;
|
||||
import org.eclipse.jetty.util.component.AggregateLifeCycle;
|
||||
import org.eclipse.jetty.util.component.Dumpable;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.resource.Resource;
|
||||
|
@ -191,9 +194,11 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server.
|
|||
public void dump(Appendable out,String indent) throws IOException
|
||||
{
|
||||
dumpThis(out);
|
||||
dump(out,indent,TypeUtil.asList(getHandlers()),getBeans(),_initParams.entrySet(), _attributes.getAttributeEntrySet(),_contextAttributes.getAttributeEntrySet());
|
||||
dump(out,indent,Collections.singletonList(new CLDump(getClassLoader())),TypeUtil.asList(getHandlers()),getBeans(),_initParams.entrySet(), _attributes.getAttributeEntrySet(),_contextAttributes.getAttributeEntrySet());
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public Context getServletContext()
|
||||
{
|
||||
|
@ -1913,4 +1918,39 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server.
|
|||
|
||||
}
|
||||
|
||||
|
||||
private static class CLDump implements Dumpable
|
||||
{
|
||||
final ClassLoader _loader;
|
||||
CLDump(ClassLoader loader)
|
||||
{
|
||||
_loader=loader;
|
||||
}
|
||||
|
||||
public String dump()
|
||||
{
|
||||
return AggregateLifeCycle.dump(this);
|
||||
}
|
||||
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
out.append(String.valueOf(_loader)).append("\n");
|
||||
|
||||
if (_loader!=null)
|
||||
{
|
||||
Object parent = _loader.getParent();
|
||||
if (parent!=null)
|
||||
{
|
||||
if (!(parent instanceof Dumpable))
|
||||
parent=new CLDump((ClassLoader)parent);
|
||||
|
||||
if (_loader instanceof URLClassLoader)
|
||||
AggregateLifeCycle.dump(out,indent,TypeUtil.asList(((URLClassLoader)_loader).getURLs()),Collections.singleton(parent));
|
||||
else
|
||||
AggregateLifeCycle.dump(out,indent,Collections.singleton(parent));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,6 +71,7 @@ public class ConnectHandlerConnectTest extends AbstractProxyHandlerTest
|
|||
"Host: " + hostPort + "\r\n" +
|
||||
"\r\n";
|
||||
Socket socket = newSocket();
|
||||
socket.setSoTimeout(30000);
|
||||
try
|
||||
{
|
||||
OutputStream output = socket.getOutputStream();
|
||||
|
@ -499,7 +500,7 @@ public class ConnectHandlerConnectTest extends AbstractProxyHandlerTest
|
|||
while ((read = input.read()) >= 0)
|
||||
baos.write(read);
|
||||
baos.close();
|
||||
|
||||
|
||||
ServletOutputStream output = httpResponse.getOutputStream();
|
||||
output.println(builder.toString());
|
||||
output.write(baos.toByteArray());
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.eclipse.jetty.server.DispatcherType;
|
|||
import org.eclipse.jetty.http.PathMap;
|
||||
import org.eclipse.jetty.server.Handler;
|
||||
import org.eclipse.jetty.util.TypeUtil;
|
||||
import org.eclipse.jetty.util.component.AggregateLifeCycle;
|
||||
import org.eclipse.jetty.util.component.Dumpable;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
|
||||
|
@ -267,4 +268,9 @@ public class FilterMapping implements Dumpable
|
|||
out.append(String.valueOf(this)).append("\n");
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public String dump()
|
||||
{
|
||||
return AggregateLifeCycle.dump(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -259,6 +259,12 @@ public class Holder<T> extends AbstractLifeCycle implements Dumpable
|
|||
out.append(_name).append("==").append(_className).append("\n");
|
||||
AggregateLifeCycle.dump(out,indent,_initParams.entrySet());
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public String dump()
|
||||
{
|
||||
return AggregateLifeCycle.dump(this);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
|
@ -8,8 +8,6 @@ import java.util.List;
|
|||
import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
import javax.naming.Binding;
|
||||
import javax.naming.Reference;
|
||||
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
|
||||
|
@ -182,11 +180,17 @@ public class AggregateLifeCycle extends AbstractLifeCycle implements Destroyable
|
|||
|
||||
/* ------------------------------------------------------------ */
|
||||
public String dump()
|
||||
{
|
||||
return dump(this);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public static String dump(Dumpable dumpable)
|
||||
{
|
||||
StringBuilder b = new StringBuilder();
|
||||
try
|
||||
{
|
||||
dump(b,"");
|
||||
dumpable.dump(b,"");
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
|
|
|
@ -4,5 +4,6 @@ import java.io.IOException;
|
|||
|
||||
public interface Dumpable
|
||||
{
|
||||
String dump();
|
||||
void dump(Appendable out,String indent) throws IOException;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,9 @@ import java.util.StringTokenizer;
|
|||
import org.eclipse.jetty.server.handler.ContextHandler;
|
||||
import org.eclipse.jetty.util.LazyList;
|
||||
import org.eclipse.jetty.util.StringUtil;
|
||||
import org.eclipse.jetty.util.TypeUtil;
|
||||
import org.eclipse.jetty.util.component.AggregateLifeCycle;
|
||||
import org.eclipse.jetty.util.component.Dumpable;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.resource.Resource;
|
||||
import org.eclipse.jetty.util.resource.ResourceCollection;
|
||||
|
@ -54,7 +57,7 @@ import org.eclipse.jetty.util.resource.ResourceCollection;
|
|||
* classloader that loaded this class is used as the parent.
|
||||
*
|
||||
*/
|
||||
public class WebAppClassLoader extends URLClassLoader
|
||||
public class WebAppClassLoader extends URLClassLoader
|
||||
{
|
||||
private final Context _context;
|
||||
private final ClassLoader _parent;
|
||||
|
@ -433,4 +436,5 @@ public class WebAppClassLoader extends URLClassLoader
|
|||
{
|
||||
return "WebAppClassLoader=" + _name+"@"+Long.toHexString(hashCode());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue