Issue #3085 - Restore Dump methods for backwards compatibility reasons.

Restored removed methods to maintain backwards compatibility.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2018-11-09 17:47:38 +01:00
parent 6c35d62a7a
commit f814354bb5
14 changed files with 52 additions and 22 deletions

View File

@ -22,7 +22,6 @@ import java.io.Closeable;
import java.io.IOException;
import java.nio.channels.AsynchronousCloseException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Queue;
import java.util.concurrent.RejectedExecutionException;
@ -472,7 +471,7 @@ public abstract class HttpDestination extends ContainerLifeCycle implements Dest
@Override
public void dump(Appendable out, String indent) throws IOException
{
dumpBeans(out, indent, new DumpableCollection("exchanges", exchanges));
dumpObjects(out, indent, new DumpableCollection("exchanges", exchanges));
}
public String asString()

View File

@ -1208,7 +1208,7 @@ public abstract class HTTP2Session extends ContainerLifeCycle implements ISessio
@Override
public void dump(Appendable out, String indent) throws IOException
{
dumpBeans(out, indent, new DumpableCollection("streams", streams.values()));
dumpObjects(out, indent, new DumpableCollection("streams", streams.values()));
}
@Override

View File

@ -31,7 +31,6 @@ import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Deque;
import java.util.Iterator;
@ -297,13 +296,13 @@ public class ManagedSelector extends ContainerLifeCycle implements Dumpable
if (keys==null)
keys = Collections.singletonList("No dump keys retrieved");
dumpBeans(out, indent,
dumpObjects(out, indent,
new DumpableCollection("updates @ "+updatesAt, updates),
new DumpableCollection("keys @ "+keysAt, keys));
}
else
{
dumpBeans(out, indent);
dumpObjects(out, indent);
}
}

View File

@ -766,7 +766,7 @@ public class ConstraintSecurityHandler extends SecurityHandler implements Constr
@Override
public void dump(Appendable out,String indent) throws IOException
{
dumpBeans(out,indent,
dumpObjects(out,indent,
DumpableCollection.from("roles",_roles),
DumpableCollection.from("constraints",_constraintMap.entrySet()));
}

View File

@ -24,7 +24,6 @@ import java.net.InetSocketAddress;
import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
@ -691,7 +690,7 @@ public class Server extends HandlerWrapper implements Attributes
@Override
public void dump(Appendable out,String indent) throws IOException
{
dumpBeans(out,indent,new ClassLoaderDump(this.getClass().getClassLoader()),_attributes);
dumpObjects(out,indent,new ClassLoaderDump(this.getClass().getClassLoader()),_attributes);
}
/* ------------------------------------------------------------ */

View File

@ -256,7 +256,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
@Override
public void dump(Appendable out, String indent) throws IOException
{
dumpBeans(out, indent,
dumpObjects(out, indent,
new ClassLoaderDump(getClassLoader()),
new DumpableCollection("eventListeners " + this, _eventListeners),
new DumpableCollection("handler attributes " + this, ((AttributesMap)getAttributes()).getAttributeEntrySet()),

View File

@ -138,7 +138,7 @@ public class InetAccessHandler extends HandlerWrapper
@Override
public void dump(Appendable out, String indent) throws IOException
{
dumpBeans(out, indent,
dumpObjects(out, indent,
DumpableCollection.from("included",_set.getIncluded()),
DumpableCollection.from("excluded",_set.getExcluded()));
}

View File

@ -137,7 +137,7 @@ public class ServletHandler extends ScopedHandler
@Override
public void dump(Appendable out, String indent) throws IOException
{
dumpBeans(out,indent,
dumpObjects(out,indent,
DumpableCollection.fromArray("listeners "+this,_listeners),
DumpableCollection.fromArray("filters "+this,_filters),
DumpableCollection.fromArray("filterMappings "+this,_filterMappings),

View File

@ -655,10 +655,21 @@ public class ContainerLifeCycle extends AbstractLifeCycle implements Container,
return Dumpable.dump(this);
}
/**
* @param dumpable the object to dump
* @return the string representation of the given Dumpable
* @deprecated use {@link Dumpable#dump(Dumpable)} instead
*/
@Deprecated
public static String dump(Dumpable dumpable)
{
return Dumpable.dump(dumpable);
}
@Override
public void dump(Appendable out, String indent) throws IOException
{
dumpBeans(out,indent);
dumpObjects(out,indent);
}
/**
@ -683,6 +694,17 @@ public class ContainerLifeCycle extends AbstractLifeCycle implements Container,
out.append(String.valueOf(this)).append(" - ").append(getState()).append("\n");
}
/**
* @param out The Appendable to dump to
* @param obj The object to dump
* @throws IOException May be thrown by the Appendable
* @deprecated use {@link Dumpable#dumpObject(Appendable, Object)} instead
*/
@Deprecated
public static void dumpObject(Appendable out, Object obj) throws IOException
{
Dumpable.dumpObject(out, obj);
}
/** Dump this object, it's contained beans and additional items to an Appendable
* @param out The appendable to dump to
@ -690,11 +712,24 @@ public class ContainerLifeCycle extends AbstractLifeCycle implements Container,
* @param items Additional items to be dumped as contained.
* @throws IOException May be thrown by the Appendable
*/
protected void dumpBeans(Appendable out, String indent, Object... items) throws IOException
protected void dumpObjects(Appendable out, String indent, Object... items) throws IOException
{
Dumpable.dumpObjects(out,indent,this, items);
}
/**
* @param out The appendable to dump to
* @param indent The indent to apply after any new lines
* @param items Additional collections to be dumped
* @throws IOException May be thrown by the Appendable
* @deprecated use {@link #dumpObjects(Appendable, String, Object...)}
*/
@Deprecated
protected void dumpBeans(Appendable out, String indent, Collection<?>... items) throws IOException
{
dump(out, indent, items);
}
@Deprecated
public static void dump(Appendable out, String indent, Collection<?>... collections) throws IOException
{

View File

@ -165,7 +165,7 @@ class SslSelectionDump extends ContainerLifeCycle implements Dumpable
@Override
public void dump(Appendable out, String indent) throws IOException
{
dumpBeans(out, indent);
dumpObjects(out, indent);
}
@Override

View File

@ -388,7 +388,7 @@ public class ExecutorThreadPool extends ContainerLifeCycle implements ThreadPool
List<Runnable> jobs = Collections.emptyList();
if (isDetailedDump())
jobs = new ArrayList<>(_executor.getQueue());
dumpBeans(out, indent, threads, new DumpableCollection("jobs", jobs));
dumpObjects(out, indent, threads, new DumpableCollection("jobs", jobs));
}
@Override

View File

@ -627,11 +627,11 @@ public class QueuedThreadPool extends ContainerLifeCycle implements SizedThreadP
if (isDetailedDump())
{
List<Runnable> jobs = new ArrayList<>(getQueue());
dumpBeans(out, indent, new DumpableCollection("threads", threads), new DumpableCollection("jobs", jobs));
dumpObjects(out, indent, new DumpableCollection("threads", threads), new DumpableCollection("jobs", jobs));
}
else
{
dumpBeans(out, indent, new DumpableCollection("threads", threads));
dumpObjects(out, indent, new DumpableCollection("threads", threads));
}
}

View File

@ -1067,7 +1067,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
Collections.sort(server_classes);
}
dumpBeans(out,indent,
dumpObjects(out,indent,
new ClassLoaderDump(getClassLoader()),
new DumpableCollection("Systemclasses "+this,system_classes),
new DumpableCollection("Serverclasses "+this,server_classes),

View File

@ -21,7 +21,6 @@ package org.eclipse.jetty.websocket.common;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.URI;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@ -38,7 +37,6 @@ 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;
@ -281,7 +279,7 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
@Override
public void dump(Appendable out, String indent) throws IOException
{
dumpBeans(out,indent,
dumpObjects(out,indent,
DumpableCollection.from("incoming", incomingHandler),
DumpableCollection.from("outgoing", outgoingHandler));
}