Issue #3242 - Cleaning up WebSocket dump
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
parent
87c82ae644
commit
689fab4979
|
@ -37,6 +37,7 @@ import org.eclipse.jetty.util.Callback;
|
|||
import org.eclipse.jetty.util.annotation.ManagedAttribute;
|
||||
import org.eclipse.jetty.util.annotation.ManagedObject;
|
||||
import org.eclipse.jetty.util.component.ContainerLifeCycle;
|
||||
import org.eclipse.jetty.util.component.Dumpable;
|
||||
import org.eclipse.jetty.util.component.DumpableCollection;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
@ -277,11 +278,13 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
|
|||
}
|
||||
|
||||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
dumpObjects(out,indent,
|
||||
DumpableCollection.from("incoming", incomingHandler),
|
||||
DumpableCollection.from("outgoing", outgoingHandler));
|
||||
public String dumpSelf() {
|
||||
return String.format("%s@%x[behavior=%s,batchMode=%s,idleTimeout=%,d,requestURI=%s]",
|
||||
this.getClass().getSimpleName(), hashCode(),
|
||||
getPolicy().getBehavior(),
|
||||
getBatchMode(),
|
||||
getIdleTimeout(),
|
||||
getRequestURI());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -39,7 +39,7 @@ import org.eclipse.jetty.websocket.common.LogicalConnection;
|
|||
import org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope;
|
||||
|
||||
@ManagedObject("Abstract Extension")
|
||||
public abstract class AbstractExtension extends AbstractLifeCycle implements Dumpable, Extension
|
||||
public abstract class AbstractExtension extends AbstractLifeCycle implements Extension
|
||||
{
|
||||
private final Logger log;
|
||||
private WebSocketPolicy policy;
|
||||
|
@ -54,27 +54,6 @@ public abstract class AbstractExtension extends AbstractLifeCycle implements Dum
|
|||
log = Log.getLogger(this.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String dump()
|
||||
{
|
||||
return Dumpable.dump(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
// incoming
|
||||
dumpWithHeading(out, indent, "incoming", this.nextIncoming);
|
||||
dumpWithHeading(out, indent, "outgoing", this.nextOutgoing);
|
||||
}
|
||||
|
||||
protected void dumpWithHeading(Appendable out, String indent, String heading, Object bean) throws IOException
|
||||
{
|
||||
out.append(indent).append(" +- ");
|
||||
out.append(heading).append(" : ");
|
||||
out.append(bean.toString());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void init(WebSocketContainerScope container)
|
||||
{
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.eclipse.jetty.util.IteratingCallback;
|
|||
import org.eclipse.jetty.util.annotation.ManagedAttribute;
|
||||
import org.eclipse.jetty.util.annotation.ManagedObject;
|
||||
import org.eclipse.jetty.util.component.ContainerLifeCycle;
|
||||
import org.eclipse.jetty.util.component.DumpableCollection;
|
||||
import org.eclipse.jetty.util.component.LifeCycle;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
@ -108,20 +109,8 @@ public class ExtensionStack extends ContainerLifeCycle implements IncomingFrames
|
|||
}
|
||||
|
||||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
super.dump(out,indent);
|
||||
|
||||
IncomingFrames websocket = getLastIncoming();
|
||||
OutgoingFrames network = getLastOutgoing();
|
||||
|
||||
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(System.lineSeparator());
|
||||
}
|
||||
out.append(indent).append(" +- Websocket: ").append(websocket.toString()).append(System.lineSeparator());
|
||||
public String dumpSelf() {
|
||||
return String.format("ExtensionStack%x [size=%d]", hashCode(), extensions.size());
|
||||
}
|
||||
|
||||
@ManagedAttribute(name = "Extension List", readonly = true)
|
||||
|
|
|
@ -30,6 +30,7 @@ import java.util.concurrent.atomic.AtomicLong;
|
|||
|
||||
import org.eclipse.jetty.io.AbstractConnection;
|
||||
import org.eclipse.jetty.io.ByteBufferPool;
|
||||
import org.eclipse.jetty.io.ChannelEndPoint;
|
||||
import org.eclipse.jetty.io.Connection;
|
||||
import org.eclipse.jetty.io.EndPoint;
|
||||
import org.eclipse.jetty.util.BufferUtil;
|
||||
|
@ -631,15 +632,16 @@ public abstract class AbstractWebSocketConnection extends AbstractConnection imp
|
|||
}
|
||||
|
||||
@Override
|
||||
public String dump()
|
||||
{
|
||||
return Dumpable.dump(this);
|
||||
public String dumpSelf() {
|
||||
return String.format("%s@%x", this.getClass().getSimpleName(), hashCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
out.append(toString()).append(System.lineSeparator());
|
||||
public void dump(Appendable out, String indent) throws IOException {
|
||||
Object endpRef = toConnectionString();
|
||||
EndPoint endp = getEndPoint();
|
||||
if(endp instanceof ChannelEndPoint)
|
||||
endpRef = ((ChannelEndPoint) endp).toEndPointString();
|
||||
Dumpable.dumpObjects(out, indent, this, endpRef, ioState, flusher, generator, parser);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue