Improved dump() output.

This commit is contained in:
Simone Bordet 2014-02-19 23:18:00 +01:00
parent 395e8f1c8b
commit 75cc42a647
4 changed files with 32 additions and 10 deletions

View File

@ -563,4 +563,11 @@ public class WebSocketClient extends ContainerLifeCycle implements SessionListen
{
this.sessionFactory = sessionFactory;
}
@Override
public void dump(Appendable out, String indent) throws IOException
{
dumpThis(out);
dump(out, indent, getOpenSessions());
}
}

View File

@ -126,7 +126,7 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Inc
@Override
public void dump(Appendable out, String indent) throws IOException
{
super.dump(out, indent);
dumpThis(out);
out.append(indent).append(" +- incomingHandler : ");
if (incomingHandler instanceof Dumpable)
{
@ -134,7 +134,7 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Inc
}
else
{
out.append(incomingHandler.toString()).append('\n');
out.append(incomingHandler.toString()).append(System.lineSeparator());
}
out.append(indent).append(" +- outgoingHandler : ");
@ -144,7 +144,7 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Inc
}
else
{
out.append(outgoingHandler.toString()).append('\n');
out.append(outgoingHandler.toString()).append(System.lineSeparator());
}
}

View File

@ -110,13 +110,13 @@ public class ExtensionStack extends ContainerLifeCycle implements IncomingFrames
IncomingFrames websocket = getLastIncoming();
OutgoingFrames network = getLastOutgoing();
out.append(indent).append(" +- Stack\n");
out.append(indent).append(" +- Network : ").append(network.toString()).append('\n');
out.append(indent).append(" +- Stack").append(System.lineSeparator());
out.append(indent).append(" +- Network : ").append(network.toString()).append(System.lineSeparator());
for (Extension ext : extensions)
{
out.append(indent).append(" +- Extension: ").append(ext.toString()).append('\n');
out.append(indent).append(" +- Extension: ").append(ext.toString()).append(System.lineSeparator());
}
out.append(indent).append(" +- Websocket: ").append(websocket.toString()).append('\n');
out.append(indent).append(" +- Websocket: ").append(websocket.toString()).append(System.lineSeparator());
}
@ManagedAttribute(name = "Extension List", readonly = true)
@ -308,7 +308,8 @@ public class ExtensionStack extends ContainerLifeCycle implements IncomingFrames
{
StringBuilder s = new StringBuilder();
s.append("ExtensionStack[");
s.append("extensions=");
s.append("queueSize=").append(entries.size());
s.append(",extensions=");
if (extensions == null)
{
s.append("<null>");

View File

@ -36,6 +36,8 @@ import org.eclipse.jetty.io.Connection;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.component.ContainerLifeCycle;
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.thread.Scheduler;
@ -60,7 +62,7 @@ import org.eclipse.jetty.websocket.common.io.IOState.ConnectionStateListener;
* Provides the implementation of {@link LogicalConnection} within the
* framework of the new {@link Connection} framework of {@code jetty-io}.
*/
public abstract class AbstractWebSocketConnection extends AbstractConnection implements LogicalConnection, ConnectionStateListener
public abstract class AbstractWebSocketConnection extends AbstractConnection implements LogicalConnection, ConnectionStateListener, Dumpable
{
private class Flusher extends FrameFlusher
{
@ -565,10 +567,22 @@ public abstract class AbstractWebSocketConnection extends AbstractConnection imp
return this;
}
@Override
public String dump()
{
return ContainerLifeCycle.dump(this);
}
@Override
public void dump(Appendable out, String indent) throws IOException
{
out.append(toString()).append(System.lineSeparator());
}
@Override
public String toString()
{
return String.format("%s{g=%s,p=%s}",super.toString(),generator,parser);
return String.format("%s{f=%s,g=%s,p=%s}",super.toString(),flusher,generator,parser);
}
}