Merge remote-tracking branch 'origin/jetty-9.4.x' into jetty-10.0.x
This commit is contained in:
commit
be120aa3b5
|
@ -123,6 +123,11 @@
|
|||
<groupId>org.eclipse.jetty.orbit</groupId>
|
||||
<artifactId>javax.mail.glassfish</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.transaction</groupId>
|
||||
<artifactId>javax.transaction-api</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.toolchain</groupId>
|
||||
<artifactId>jetty-test-helper</artifactId>
|
||||
|
|
|
@ -63,7 +63,7 @@ public class LikeJettyXml
|
|||
public static void main( String[] args ) throws Exception
|
||||
{
|
||||
// Path to as-built jetty-distribution directory
|
||||
String jettyHomeBuild = "../../jetty-distribution/target/distribution";
|
||||
String jettyHomeBuild = "jetty-distribution/target/distribution";
|
||||
|
||||
// Find jetty home and base directories
|
||||
String homePath = System.getProperty("jetty.home", jettyHomeBuild);
|
||||
|
|
|
@ -137,7 +137,7 @@ public class ManyConnectors
|
|||
|
||||
// Start the server
|
||||
server.start();
|
||||
|
||||
server.dumpStdErr();
|
||||
server.join();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ public class ManyContexts
|
|||
server.setHandler(contexts);
|
||||
|
||||
server.start();
|
||||
server.dumpStdErr();
|
||||
server.join();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@ public class OneServletContextWithSession
|
|||
context.addServlet(HelloSessionServlet.class, "/");
|
||||
|
||||
server.start();
|
||||
server.dumpStdErr();
|
||||
server.join();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.lang.management.ManagementFactory;
|
|||
import org.eclipse.jetty.jmx.MBeanContainer;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.handler.AllowSymLinkAliasChecker;
|
||||
import org.eclipse.jetty.webapp.Configurations;
|
||||
import org.eclipse.jetty.webapp.WebAppContext;
|
||||
|
||||
public class OneWebApp
|
||||
|
@ -62,6 +63,8 @@ public class OneWebApp
|
|||
// the server so it is aware of where to send the appropriate requests.
|
||||
server.setHandler(webapp);
|
||||
|
||||
Configurations.setServerDefault(server);
|
||||
|
||||
// Start things up!
|
||||
server.start();
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ public class ServerWithAnnotations
|
|||
|
||||
webapp.setContextPath("/");
|
||||
File warFile = new File(
|
||||
"../../jetty-distribution/target/distribution/demo-base/webapps/test.war");
|
||||
"jetty-distribution/target/distribution/demo-base/webapps/test.war");
|
||||
webapp.setWar(warFile.getAbsolutePath());
|
||||
webapp.setAttribute(
|
||||
"org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",
|
||||
|
@ -69,10 +69,11 @@ public class ServerWithAnnotations
|
|||
// Configure a LoginService
|
||||
HashLoginService loginService = new HashLoginService();
|
||||
loginService.setName("Test Realm");
|
||||
loginService.setConfig("src/test/resources/realm.properties");
|
||||
loginService.setConfig("examples/embedded/src/test/resources/realm.properties");
|
||||
server.addBean(loginService);
|
||||
|
||||
server.start();
|
||||
server.dumpStdErr();
|
||||
server.join();
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.eclipse.jetty.util.Callback;
|
|||
import org.eclipse.jetty.util.Promise;
|
||||
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.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
@ -212,6 +211,6 @@ public abstract class AbstractConnectionPool implements ConnectionPool, Dumpable
|
|||
@Override
|
||||
public String dump()
|
||||
{
|
||||
return ContainerLifeCycle.dump(this);
|
||||
return Dumpable.dump(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,8 @@ import org.eclipse.jetty.client.api.Destination;
|
|||
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;
|
||||
import org.eclipse.jetty.util.thread.Sweeper;
|
||||
|
@ -239,20 +240,24 @@ public class DuplexConnectionPool extends AbstractConnectionPool implements Swee
|
|||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
List<Connection> connections = new ArrayList<>();
|
||||
DumpableCollection active;
|
||||
DumpableCollection idle;
|
||||
lock();
|
||||
try
|
||||
{
|
||||
connections.addAll(activeConnections);
|
||||
connections.addAll(idleConnections);
|
||||
active = new DumpableCollection("active",new ArrayList<>(activeConnections));
|
||||
idle = new DumpableCollection("idle",new ArrayList<>(idleConnections));
|
||||
}
|
||||
finally
|
||||
{
|
||||
unlock();
|
||||
}
|
||||
dump(out, indent, active, idle);
|
||||
}
|
||||
|
||||
ContainerLifeCycle.dumpObject(out, this);
|
||||
ContainerLifeCycle.dump(out, indent, connections);
|
||||
protected void dump(Appendable out, String indent, Object... items) throws IOException
|
||||
{
|
||||
Dumpable.dumpObjects(out, indent, this, items);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -472,8 +472,7 @@ public abstract class HttpDestination extends ContainerLifeCycle implements Dest
|
|||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
super.dump(out, indent);
|
||||
ContainerLifeCycle.dump(out, indent, Collections.singleton(new DumpableCollection("exchanges", exchanges)));
|
||||
dumpBeans(out, indent, new DumpableCollection("exchanges", exchanges));
|
||||
}
|
||||
|
||||
public String asString()
|
||||
|
|
|
@ -31,7 +31,8 @@ import java.util.stream.Collectors;
|
|||
|
||||
import org.eclipse.jetty.client.api.Connection;
|
||||
import org.eclipse.jetty.util.Callback;
|
||||
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;
|
||||
import org.eclipse.jetty.util.thread.Sweeper;
|
||||
|
@ -310,21 +311,22 @@ public class MultiplexConnectionPool extends AbstractConnectionPool implements C
|
|||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
List<Holder> connections = new ArrayList<>();
|
||||
DumpableCollection busy;
|
||||
DumpableCollection muxed;
|
||||
DumpableCollection idle;
|
||||
lock();
|
||||
try
|
||||
{
|
||||
connections.addAll(busyConnections.values());
|
||||
connections.addAll(muxedConnections.values());
|
||||
connections.addAll(idleConnections);
|
||||
busy = new DumpableCollection("busy", new ArrayList<>(busyConnections.values()));
|
||||
muxed = new DumpableCollection("muxed", new ArrayList<>(muxedConnections.values()));
|
||||
idle = new DumpableCollection("idle", new ArrayList<>(idleConnections));
|
||||
}
|
||||
finally
|
||||
{
|
||||
unlock();
|
||||
}
|
||||
|
||||
ContainerLifeCycle.dumpObject(out, this);
|
||||
ContainerLifeCycle.dump(out, indent, connections);
|
||||
Dumpable.dumpObjects(out, indent, this, busy, muxed, idle);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.eclipse.jetty.client.api.Connection;
|
|||
import org.eclipse.jetty.client.api.Destination;
|
||||
import org.eclipse.jetty.util.Callback;
|
||||
import org.eclipse.jetty.util.annotation.ManagedObject;
|
||||
import org.eclipse.jetty.util.component.ContainerLifeCycle;
|
||||
import org.eclipse.jetty.util.component.Dumpable;
|
||||
|
||||
@ManagedObject
|
||||
public class RoundRobinConnectionPool extends AbstractConnectionPool implements ConnectionPool.Multiplexable
|
||||
|
@ -192,8 +192,7 @@ public class RoundRobinConnectionPool extends AbstractConnectionPool implements
|
|||
{
|
||||
connections = new ArrayList<>(entries);
|
||||
}
|
||||
ContainerLifeCycle.dumpObject(out, this);
|
||||
ContainerLifeCycle.dump(out, indent, connections);
|
||||
Dumpable.dumpObjects(out, indent, out, connections);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -23,12 +23,13 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.eclipse.jetty.client.api.Connection;
|
||||
import org.eclipse.jetty.client.api.Destination;
|
||||
import org.eclipse.jetty.util.Callback;
|
||||
import org.eclipse.jetty.util.annotation.ManagedAttribute;
|
||||
import org.eclipse.jetty.util.component.ContainerLifeCycle;
|
||||
import org.eclipse.jetty.util.component.DumpableCollection;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.thread.Scheduler;
|
||||
|
@ -129,10 +130,10 @@ public class ValidatingConnectionPool extends DuplexConnectionPool
|
|||
}
|
||||
|
||||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
protected void dump(Appendable out, String indent, Object... items) throws IOException
|
||||
{
|
||||
super.dump(out, indent);
|
||||
ContainerLifeCycle.dump(out, indent, quarantine.values());
|
||||
DumpableCollection toDump = new DumpableCollection("quarantine", quarantine.values());
|
||||
super.dump(out, indent, Stream.concat(Stream.of(items), Stream.of(toDump)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -31,7 +31,6 @@ import org.eclipse.jetty.util.ArrayTernaryTrie;
|
|||
import org.eclipse.jetty.util.Trie;
|
||||
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.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
@ -56,14 +55,13 @@ public class PathMappings<E> implements Iterable<MappedResource<E>>, Dumpable
|
|||
@Override
|
||||
public String dump()
|
||||
{
|
||||
return ContainerLifeCycle.dump(this);
|
||||
return Dumpable.dump(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
out.append("PathMappings[size=").append(Integer.toString(_mappings.size())).append("]\n");
|
||||
ContainerLifeCycle.dump(out, indent, _mappings);
|
||||
Dumpable.dumpObjects(out, indent, toString(), _mappings);
|
||||
}
|
||||
|
||||
@ManagedAttribute(value = "mappings", readonly = true)
|
||||
|
|
|
@ -29,7 +29,6 @@ import org.eclipse.jetty.http2.frames.WindowUpdateFrame;
|
|||
import org.eclipse.jetty.util.annotation.ManagedAttribute;
|
||||
import org.eclipse.jetty.util.annotation.ManagedObject;
|
||||
import org.eclipse.jetty.util.annotation.ManagedOperation;
|
||||
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;
|
||||
|
@ -243,7 +242,7 @@ public abstract class AbstractFlowControlStrategy implements FlowControlStrategy
|
|||
@Override
|
||||
public String dump()
|
||||
{
|
||||
return ContainerLifeCycle.dump(this);
|
||||
return Dumpable.dump(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -34,7 +34,6 @@ import org.eclipse.jetty.io.ByteBufferPool;
|
|||
import org.eclipse.jetty.io.EofException;
|
||||
import org.eclipse.jetty.util.Callback;
|
||||
import org.eclipse.jetty.util.IteratingCallback;
|
||||
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;
|
||||
|
@ -353,7 +352,7 @@ public class HTTP2Flusher extends IteratingCallback implements Dumpable
|
|||
@Override
|
||||
public String dump()
|
||||
{
|
||||
return ContainerLifeCycle.dump(this);
|
||||
return Dumpable.dump(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -62,6 +62,7 @@ import org.eclipse.jetty.util.Retainable;
|
|||
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;
|
||||
|
@ -1205,8 +1206,7 @@ public abstract class HTTP2Session extends ContainerLifeCycle implements ISessio
|
|||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
super.dump(out, indent);
|
||||
dump(out, indent, Collections.singleton(new DumpableCollection("streams", streams.values())));
|
||||
Dumpable.dumpObjects(out, indent, this, new DumpableCollection("streams", streams.values()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -42,7 +42,6 @@ import org.eclipse.jetty.http2.frames.WindowUpdateFrame;
|
|||
import org.eclipse.jetty.io.IdleTimeout;
|
||||
import org.eclipse.jetty.util.Callback;
|
||||
import org.eclipse.jetty.util.Promise;
|
||||
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;
|
||||
|
@ -616,7 +615,7 @@ public class HTTP2Stream extends IdleTimeout implements IStream, Callback, Dumpa
|
|||
@Override
|
||||
public String dump()
|
||||
{
|
||||
return ContainerLifeCycle.dump(this);
|
||||
return Dumpable.dump(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -43,7 +43,6 @@ import org.eclipse.jetty.server.HttpConfiguration;
|
|||
import org.eclipse.jetty.util.annotation.ManagedAttribute;
|
||||
import org.eclipse.jetty.util.annotation.ManagedObject;
|
||||
import org.eclipse.jetty.util.annotation.Name;
|
||||
import org.eclipse.jetty.util.component.ContainerLifeCycle;
|
||||
import org.eclipse.jetty.util.component.Dumpable;
|
||||
import org.eclipse.jetty.util.component.LifeCycle;
|
||||
|
||||
|
@ -288,14 +287,13 @@ public abstract class AbstractHTTP2ServerConnectionFactory extends AbstractConne
|
|||
@Override
|
||||
public String dump()
|
||||
{
|
||||
return ContainerLifeCycle.dump(this);
|
||||
return Dumpable.dump(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
ContainerLifeCycle.dumpObject(out, this);
|
||||
ContainerLifeCycle.dump(out, indent, sessions);
|
||||
Dumpable.dumpObjects(out,indent,this, sessions);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
package org.eclipse.jetty.io;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.concurrent.atomic.LongAdder;
|
||||
|
@ -29,7 +27,6 @@ import org.eclipse.jetty.util.annotation.ManagedAttribute;
|
|||
import org.eclipse.jetty.util.annotation.ManagedObject;
|
||||
import org.eclipse.jetty.util.annotation.ManagedOperation;
|
||||
import org.eclipse.jetty.util.component.AbstractLifeCycle;
|
||||
import org.eclipse.jetty.util.component.ContainerLifeCycle;
|
||||
import org.eclipse.jetty.util.component.Dumpable;
|
||||
import org.eclipse.jetty.util.statistic.CounterStatistic;
|
||||
import org.eclipse.jetty.util.statistic.SampleStatistic;
|
||||
|
@ -210,19 +207,17 @@ public class ConnectionStatistics extends AbstractLifeCycle implements Connectio
|
|||
@Override
|
||||
public String dump()
|
||||
{
|
||||
return ContainerLifeCycle.dump(this);
|
||||
return Dumpable.dump(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
ContainerLifeCycle.dumpObject(out, this);
|
||||
List<String> children = new ArrayList<>();
|
||||
children.add(String.format("connections=%s", _connections));
|
||||
children.add(String.format("durations=%s", _connectionsDuration));
|
||||
children.add(String.format("bytes in/out=%s/%s", getReceivedBytes(), getSentBytes()));
|
||||
children.add(String.format("messages in/out=%s/%s", getReceivedMessages(), getSentMessages()));
|
||||
ContainerLifeCycle.dump(out, indent, children);
|
||||
Dumpable.dumpObjects(out,indent,this,
|
||||
String.format("connections=%s", _connections),
|
||||
String.format("durations=%s", _connectionsDuration),
|
||||
String.format("bytes in/out=%s/%s", getReceivedBytes(), getSentBytes()),
|
||||
String.format("messages in/out=%s/%s", getReceivedMessages(), getSentMessages()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -296,8 +296,10 @@ public class ManagedSelector extends ContainerLifeCycle implements Dumpable
|
|||
String keysAt = DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(ZonedDateTime.now());
|
||||
if (keys==null)
|
||||
keys = Collections.singletonList("No dump keys retrieved");
|
||||
dumpBeans(out, indent, Arrays.asList(new DumpableCollection("updates @ "+updatesAt, updates),
|
||||
new DumpableCollection("keys @ "+keysAt, keys)));
|
||||
|
||||
dumpBeans(out, indent,
|
||||
new DumpableCollection("updates @ "+updatesAt, updates),
|
||||
new DumpableCollection("keys @ "+keysAt, keys));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -543,7 +545,7 @@ public class ManagedSelector extends ContainerLifeCycle implements Dumpable
|
|||
*/
|
||||
public interface SelectorUpdate
|
||||
{
|
||||
public void update(Selector selector);
|
||||
void update(Selector selector);
|
||||
}
|
||||
|
||||
private class Start implements SelectorUpdate
|
||||
|
@ -567,8 +569,7 @@ public class ManagedSelector extends ContainerLifeCycle implements Dumpable
|
|||
public void update(Selector selector)
|
||||
{
|
||||
Set<SelectionKey> selector_keys = selector.keys();
|
||||
List<String> list = new ArrayList<>(selector_keys.size()+1);
|
||||
list.add(selector + " keys=" + selector_keys.size());
|
||||
List<String> list = new ArrayList<>(selector_keys.size());
|
||||
for (SelectionKey key : selector_keys)
|
||||
{
|
||||
if (key==null)
|
||||
|
|
|
@ -398,14 +398,13 @@ public class MBeanContainer implements Container.InheritedListener, Dumpable, De
|
|||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
ContainerLifeCycle.dumpObject(out, this);
|
||||
ContainerLifeCycle.dump(out, indent, _mbeans.entrySet());
|
||||
Dumpable.dumpObjects(out, indent, this, _mbeans.entrySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String dump()
|
||||
{
|
||||
return ContainerLifeCycle.dump(this);
|
||||
return Dumpable.dump(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -485,13 +485,6 @@ public class ConnectHandler extends HandlerWrapper
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
dumpThis(out);
|
||||
dump(out, indent, getBeans(), TypeUtil.asList(getHandlers()));
|
||||
}
|
||||
|
||||
protected class ConnectManager extends SelectorManager
|
||||
{
|
||||
protected ConnectManager(Executor executor, Scheduler scheduler, int selectors)
|
||||
|
|
|
@ -47,6 +47,7 @@ import org.eclipse.jetty.server.Response;
|
|||
import org.eclipse.jetty.server.UserIdentity;
|
||||
import org.eclipse.jetty.server.handler.ContextHandler;
|
||||
import org.eclipse.jetty.util.URIUtil;
|
||||
import org.eclipse.jetty.util.component.DumpableCollection;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.security.Constraint;
|
||||
|
@ -768,11 +769,11 @@ public class ConstraintSecurityHandler extends SecurityHandler implements Constr
|
|||
{
|
||||
// TODO these should all be beans
|
||||
dumpBeans(out, indent,
|
||||
Collections.singleton(getLoginService()),
|
||||
Collections.singleton(getIdentityService()),
|
||||
Collections.singleton(getAuthenticator()),
|
||||
Collections.singleton(_roles),
|
||||
_constraintRoles.getMappings());
|
||||
getLoginService(),
|
||||
getIdentityService(),
|
||||
getAuthenticator(),
|
||||
DumpableCollection.from("roles",_roles),
|
||||
DumpableCollection.from("constraints",_constraintMappings));
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
|
@ -20,11 +20,7 @@ package org.eclipse.jetty.server;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.eclipse.jetty.util.TypeUtil;
|
||||
import org.eclipse.jetty.util.component.ContainerLifeCycle;
|
||||
import org.eclipse.jetty.util.component.Dumpable;
|
||||
import org.eclipse.jetty.util.component.DumpableCollection;
|
||||
|
||||
|
@ -40,7 +36,7 @@ public class ClassLoaderDump implements Dumpable
|
|||
@Override
|
||||
public String dump()
|
||||
{
|
||||
return ContainerLifeCycle.dump(this);
|
||||
return Dumpable.dump(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -50,49 +46,47 @@ public class ClassLoaderDump implements Dumpable
|
|||
out.append("No ClassLoader\n");
|
||||
else if (_loader instanceof Dumpable)
|
||||
{
|
||||
ContainerLifeCycle.dump(out,indent,Collections.singleton(_loader));
|
||||
((Dumpable)_loader).dump(out,indent);
|
||||
}
|
||||
else if (_loader instanceof URLClassLoader)
|
||||
{
|
||||
out.append(String.valueOf(_loader)).append("\n");
|
||||
|
||||
DumpableCollection urls = new DumpableCollection("URLs",TypeUtil.asList(((URLClassLoader)_loader).getURLs()));
|
||||
String loader = _loader.toString();
|
||||
DumpableCollection urls = DumpableCollection.fromArray("URLs", ((URLClassLoader)_loader).getURLs());
|
||||
ClassLoader parent = _loader.getParent();
|
||||
if (parent==null)
|
||||
ContainerLifeCycle.dump(out,indent,Collections.singleton(urls));
|
||||
Dumpable.dumpObjects(out,indent,loader,urls);
|
||||
else if (parent == Server.class.getClassLoader())
|
||||
ContainerLifeCycle.dump(out,indent,Collections.singleton(urls),Collections.singleton("Server loader: " + parent.toString()));
|
||||
Dumpable.dumpObjects(out,indent,loader,urls,parent.toString());
|
||||
else if (parent instanceof Dumpable)
|
||||
ContainerLifeCycle.dump(out,indent,Collections.singleton(urls),Collections.singleton(parent));
|
||||
Dumpable.dumpObjects(out,indent,loader,urls,parent);
|
||||
else
|
||||
ContainerLifeCycle.dump(out,indent,Collections.singleton(urls),Collections.singleton(new ClassLoaderDump(parent)));
|
||||
Dumpable.dumpObjects(out,indent,loader,urls,new ClassLoaderDump(parent));
|
||||
}
|
||||
else if (_loader.getDefinedPackages()!=null)
|
||||
{
|
||||
out.append(String.valueOf(_loader)).append("\n");
|
||||
|
||||
DumpableCollection packages = new DumpableCollection("packages", Arrays.asList(_loader.getDefinedPackages()));
|
||||
DumpableCollection packages = DumpableCollection.from("packages", _loader.getDefinedPackages());
|
||||
ClassLoader parent = _loader.getParent();
|
||||
if (parent==Server.class.getClassLoader())
|
||||
ContainerLifeCycle.dump(out,indent,Collections.singleton(packages),Collections.singleton("Server loader: " + parent));
|
||||
Dumpable.dumpObjects(out,indent,_loader,packages,"Server loader: " + parent);
|
||||
else if (parent instanceof Dumpable)
|
||||
ContainerLifeCycle.dump(out,indent,Collections.singleton(packages),Collections.singleton(parent));
|
||||
Dumpable.dumpObjects(out,indent,_loader,packages,parent);
|
||||
else if (parent!=null)
|
||||
ContainerLifeCycle.dump(out,indent,Collections.singleton(packages),Collections.singleton(new ClassLoaderDump(parent)));
|
||||
Dumpable.dumpObjects(out,indent,_loader,packages,new ClassLoaderDump(parent));
|
||||
else
|
||||
ContainerLifeCycle.dump(out,indent,Collections.singleton(packages));
|
||||
Dumpable.dumpObjects(out,indent,_loader,packages);
|
||||
}
|
||||
else
|
||||
{
|
||||
out.append(String.valueOf(_loader)).append("\n");
|
||||
|
||||
String loader = _loader.toString();
|
||||
ClassLoader parent = _loader.getParent();
|
||||
if (parent==null)
|
||||
Dumpable.dumpObject(out,loader);
|
||||
if (parent==Server.class.getClassLoader())
|
||||
ContainerLifeCycle.dump(out,indent,Collections.singleton("Server loader: " + parent));
|
||||
Dumpable.dumpObjects(out,indent,loader,parent.toString());
|
||||
else if (parent instanceof Dumpable)
|
||||
ContainerLifeCycle.dump(out,indent,Collections.singleton(parent));
|
||||
Dumpable.dumpObjects(out,indent,loader,parent);
|
||||
else if (parent!=null)
|
||||
ContainerLifeCycle.dump(out,indent,Collections.singleton(new ClassLoaderDump(parent)));
|
||||
Dumpable.dumpObjects(out,indent,loader,new ClassLoaderDump(parent));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -662,6 +662,7 @@ public class Server extends HandlerWrapper implements Attributes
|
|||
@Override
|
||||
public void setAttribute(String name, Object attribute)
|
||||
{
|
||||
// TODO this is a crude way to get attribute values managed by JMX.
|
||||
Object old=_attributes.getAttribute(name);
|
||||
updateBean(old,attribute);
|
||||
_attributes.setAttribute(name, attribute);
|
||||
|
@ -724,7 +725,7 @@ public class Server extends HandlerWrapper implements Attributes
|
|||
@Override
|
||||
public void dump(Appendable out,String indent) throws IOException
|
||||
{
|
||||
dumpBeans(out,indent,Collections.singleton(new ClassLoaderDump(this.getClass().getClassLoader())));
|
||||
dumpBeans(out,indent,new ClassLoaderDump(this.getClass().getClassLoader()),_attributes);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
|
@ -257,11 +257,12 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
dumpBeans(out,indent,Collections.singletonList(new ClassLoaderDump(getClassLoader())),
|
||||
Collections.singletonList(new DumpableCollection("eventListeners "+this,_eventListeners)),
|
||||
Collections.singletonList(new DumpableCollection("handler attributes " + this,((AttributesMap)getAttributes()).getAttributeEntrySet())),
|
||||
Collections.singletonList(new DumpableCollection("context attributes " + this,((Context)getServletContext()).getAttributeEntrySet())),
|
||||
Collections.singletonList(new DumpableCollection("initparams " + this,getInitParams().entrySet())));
|
||||
dumpBeans(out, indent,
|
||||
new ClassLoaderDump(getClassLoader()),
|
||||
new DumpableCollection("eventListeners " + this, _eventListeners),
|
||||
new DumpableCollection("handler attributes " + this, ((AttributesMap)getAttributes()).getAttributeEntrySet()),
|
||||
new DumpableCollection("context attributes " + this, ((Context)getServletContext()).getAttributeEntrySet()),
|
||||
new DumpableCollection("initparams " + this,getInitParams().entrySet()));
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
|
@ -335,7 +335,7 @@ public class ContextHandlerCollection extends HandlerCollection
|
|||
{
|
||||
return _handler;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
|
|
|
@ -202,12 +202,4 @@ public class HandlerCollection extends AbstractHandlerContainer
|
|||
child.destroy();
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
Handler[] handlers=getHandlers();
|
||||
return super.toString()+(handlers==null?"[]":Arrays.asList(handlers).toString());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.eclipse.jetty.server.HttpChannel;
|
|||
import org.eclipse.jetty.server.Request;
|
||||
import org.eclipse.jetty.util.IncludeExcludeSet;
|
||||
import org.eclipse.jetty.util.InetAddressSet;
|
||||
import org.eclipse.jetty.util.component.DumpableCollection;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
||||
|
@ -137,6 +138,8 @@ public class InetAccessHandler extends HandlerWrapper
|
|||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
dumpBeans(out, indent, _set.getIncluded(), _set.getExcluded());
|
||||
dumpBeans(out, indent,
|
||||
DumpableCollection.from("included",_set.getIncluded()),
|
||||
DumpableCollection.from("excluded",_set.getExcluded()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,8 +48,8 @@ public class ClassLoaderDumptTest
|
|||
StringBuilder out = new StringBuilder();
|
||||
server.dump(out);
|
||||
String dump = out.toString();
|
||||
assertThat(dump,containsString("+- SimpleLoader"));
|
||||
assertThat(dump,containsString("+> "+Server.class.getClassLoader()));
|
||||
assertThat(dump,containsString("+-SimpleLoader"));
|
||||
assertThat(dump,containsString("+>"+Server.class.getClassLoader()));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -69,9 +69,9 @@ public class ClassLoaderDumptTest
|
|||
StringBuilder out = new StringBuilder();
|
||||
server.dump(out);
|
||||
String dump = out.toString();
|
||||
assertThat(dump,containsString("+- ParentedLoader"));
|
||||
assertThat(dump,containsString("| +- "+Server.class.getClassLoader()));
|
||||
assertThat(dump,containsString("+> "+Server.class.getClassLoader()));
|
||||
assertThat(dump,containsString("+-ParentedLoader"));
|
||||
assertThat(dump,containsString("| +>"+Server.class.getClassLoader()));
|
||||
assertThat(dump,containsString("+>"+Server.class.getClassLoader()));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -98,10 +98,10 @@ public class ClassLoaderDumptTest
|
|||
StringBuilder out = new StringBuilder();
|
||||
server.dump(out);
|
||||
String dump = out.toString();
|
||||
assertThat(dump,containsString("+- TopLoader"));
|
||||
assertThat(dump,containsString("| +- MiddleLoader"));
|
||||
assertThat(dump,containsString("| +- "+Server.class.getClassLoader()));
|
||||
assertThat(dump,containsString("+> "+Server.class.getClassLoader()));
|
||||
assertThat(dump,containsString("+-TopLoader"));
|
||||
assertThat(dump,containsString("| +>MiddleLoader"));
|
||||
assertThat(dump,containsString("| +>"+Server.class.getClassLoader()));
|
||||
assertThat(dump,containsString("+>"+Server.class.getClassLoader()));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -122,10 +122,10 @@ public class ClassLoaderDumptTest
|
|||
StringBuilder out = new StringBuilder();
|
||||
server.dump(out);
|
||||
String dump = out.toString();
|
||||
assertThat(dump,containsString("+- TopLoader"));
|
||||
assertThat(dump,containsString("| +- DumpableClassLoader"));
|
||||
assertThat(dump,not(containsString("| +- "+Server.class.getClassLoader())));
|
||||
assertThat(dump,containsString("+> "+Server.class.getClassLoader()));
|
||||
assertThat(dump,containsString("+-TopLoader"));
|
||||
assertThat(dump,containsString("| +>DumpableClassLoader"));
|
||||
assertThat(dump,not(containsString("| +>"+Server.class.getClassLoader())));
|
||||
assertThat(dump,containsString("+>"+Server.class.getClassLoader()));
|
||||
}
|
||||
|
||||
public static class DumpableClassLoader extends ClassLoader implements Dumpable
|
||||
|
@ -184,15 +184,15 @@ public class ClassLoaderDumptTest
|
|||
server.dump(out);
|
||||
String dump = out.toString();
|
||||
// System.err.println(dump);
|
||||
assertThat(dump,containsString("+- TopLoader"));
|
||||
assertThat(dump,containsString("| +- file:/ONE"));
|
||||
assertThat(dump,containsString("| +- file:/TWO"));
|
||||
assertThat(dump,containsString("| +- file:/THREE"));
|
||||
assertThat(dump,containsString("| +- MiddleLoader"));
|
||||
assertThat(dump,containsString("| +- file:/one"));
|
||||
assertThat(dump,containsString("| +- file:/two"));
|
||||
assertThat(dump,containsString("| +- file:/three"));
|
||||
assertThat(dump,containsString("| +- "+Server.class.getClassLoader()));
|
||||
assertThat(dump,containsString("+> "+Server.class.getClassLoader()));
|
||||
assertThat(dump,containsString("+-TopLoader"));
|
||||
assertThat(dump,containsString("| | +>file:/ONE"));
|
||||
assertThat(dump,containsString("| | +>file:/TWO"));
|
||||
assertThat(dump,containsString("| | +>file:/THREE"));
|
||||
assertThat(dump,containsString("| +>MiddleLoader"));
|
||||
assertThat(dump,containsString("| | +>file:/one"));
|
||||
assertThat(dump,containsString("| | +>file:/two"));
|
||||
assertThat(dump,containsString("| | +>file:/three"));
|
||||
assertThat(dump,containsString("| +>"+Server.class.getClassLoader()));
|
||||
assertThat(dump,containsString("+>"+Server.class.getClassLoader()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.eclipse.jetty.server.handler.ContextHandler;
|
|||
import org.eclipse.jetty.util.Loader;
|
||||
import org.eclipse.jetty.util.annotation.ManagedAttribute;
|
||||
import org.eclipse.jetty.util.component.AbstractLifeCycle;
|
||||
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;
|
||||
|
@ -194,14 +193,13 @@ public abstract class BaseHolder<T> extends AbstractLifeCycle implements Dumpabl
|
|||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
out.append(toString())
|
||||
.append(" - ").append(AbstractLifeCycle.getState(this)).append("\n");
|
||||
Dumpable.dumpObject(out, this);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public String dump()
|
||||
{
|
||||
return ContainerLifeCycle.dump(this);
|
||||
return Dumpable.dump(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ import org.eclipse.jetty.util.component.DumpableCollection;
|
|||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
||||
public class FilterHolder extends Holder<Filter>
|
||||
public class FilterHolder extends Holder<Filter>
|
||||
{
|
||||
private static final Logger LOG = Log.getLogger(FilterHolder.class);
|
||||
|
||||
|
@ -104,10 +104,6 @@ public class FilterHolder extends Holder<Filter>
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
|
@ -199,21 +195,24 @@ public class FilterHolder extends Holder<Filter>
|
|||
return _filter;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return getName();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
out.append(toString()).append(" - ").append(AbstractLifeCycle.getState(this)).append('\n');
|
||||
ContainerLifeCycle.dump(out,indent,
|
||||
Collections.singletonList(_filter),
|
||||
Collections.singletonList(new DumpableCollection("initParams", _initParams.entrySet())));
|
||||
if (_initParams.isEmpty())
|
||||
Dumpable.dumpObjects(out, indent, this,
|
||||
_filter == null?getHeldClass():_filter);
|
||||
else
|
||||
Dumpable.dumpObjects(out, indent, this,
|
||||
_filter == null?getHeldClass():_filter,
|
||||
new DumpableCollection("initParams", _initParams.entrySet()));
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return String.format("%s@%x==%s,inst=%b,async=%b",_name,hashCode(),_className,_filter!=null,isAsyncSupported());
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
|
@ -29,7 +29,6 @@ import org.eclipse.jetty.http.pathmap.ServletPathSpec;
|
|||
import org.eclipse.jetty.util.TypeUtil;
|
||||
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;
|
||||
|
||||
@ManagedObject("Filter Mappings")
|
||||
|
@ -334,6 +333,6 @@ public class FilterMapping implements Dumpable
|
|||
@Override
|
||||
public String dump()
|
||||
{
|
||||
return ContainerLifeCycle.dump(this);
|
||||
return Dumpable.dump(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import javax.servlet.ServletContext;
|
|||
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.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
||||
|
@ -45,7 +46,7 @@ import org.eclipse.jetty.util.log.Logger;
|
|||
* @param <T> the type of holder
|
||||
*/
|
||||
@ManagedObject("Holder - a container for servlets and the like")
|
||||
public class Holder<T> extends BaseHolder<T>
|
||||
public abstract class Holder<T> extends BaseHolder<T>
|
||||
{
|
||||
private static final Logger LOG = Log.getLogger(Holder.class);
|
||||
|
||||
|
@ -188,15 +189,6 @@ public class Holder<T> extends BaseHolder<T>
|
|||
return _asyncSupported;
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
super.dump(out,indent);
|
||||
ContainerLifeCycle.dump(out,indent,_initParams.entrySet());
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public String dump()
|
||||
|
|
|
@ -137,11 +137,11 @@ public class ServletHandler extends ScopedHandler
|
|||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
dumpBeans(out,indent,
|
||||
Collections.singletonList(new DumpableCollection("listeners "+this,_listeners)),
|
||||
Collections.singletonList(new DumpableCollection("filters "+this,_filters)),
|
||||
Collections.singletonList(new DumpableCollection("filterMappings "+this,_filterMappings)),
|
||||
Collections.singletonList(new DumpableCollection("servlets "+this,_servlets)),
|
||||
Collections.singletonList(new DumpableCollection("servletMappings "+this,_servletMappings)));
|
||||
DumpableCollection.fromArray("listeners "+this,_listeners),
|
||||
DumpableCollection.fromArray("filters "+this,_filters),
|
||||
DumpableCollection.fromArray("filterMappings "+this,_filterMappings),
|
||||
DumpableCollection.fromArray("servlets "+this,_servlets),
|
||||
DumpableCollection.fromArray("servletMappings "+this,_servletMappings));
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
|
|
|
@ -55,6 +55,8 @@ import org.eclipse.jetty.util.Loader;
|
|||
import org.eclipse.jetty.util.StringUtil;
|
||||
import org.eclipse.jetty.util.annotation.ManagedAttribute;
|
||||
import org.eclipse.jetty.util.annotation.ManagedObject;
|
||||
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;
|
||||
|
||||
|
@ -1312,11 +1314,23 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
|
|||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
if (_initParams.isEmpty())
|
||||
Dumpable.dumpObjects(out, indent, this,
|
||||
_servlet == null?getHeldClass():_servlet);
|
||||
else
|
||||
Dumpable.dumpObjects(out, indent, this,
|
||||
_servlet == null?getHeldClass():_servlet,
|
||||
new DumpableCollection("initParams", _initParams.entrySet()));
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return String.format("%s@%x==%s,jsp=%s,order=%d,inst=%b",_name,hashCode(),_className,_forcedPath,_initOrder,_servlet!=null);
|
||||
return String.format("%s@%x==%s,jsp=%s,order=%d,inst=%b,async=%b",_name,hashCode(),_className,_forcedPath,_initOrder,_servlet!=null,isAsyncSupported());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
|
||||
package org.eclipse.jetty.util;
|
||||
|
||||
import org.eclipse.jetty.util.component.Dumpable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
|
@ -28,7 +31,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class AttributesMap implements Attributes
|
||||
public class AttributesMap implements Attributes, Dumpable
|
||||
{
|
||||
private final AtomicReference<ConcurrentMap<String, Object>> _map = new AtomicReference<>();
|
||||
|
||||
|
@ -148,4 +151,16 @@ public class AttributesMap implements Attributes
|
|||
setAttribute(name, attributes.getAttribute(name));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String dump()
|
||||
{
|
||||
return Dumpable.dump(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
Dumpable.dumpObjects(out,indent,String.format("%s@%x",this.getClass().getSimpleName(),hashCode()),map());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.eclipse.jetty.util.component;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
|
@ -231,6 +230,30 @@ public class ContainerLifeCycle extends AbstractLifeCycle implements Container,
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bean the bean to test
|
||||
* @return whether this aggregate contains the bean in auto state
|
||||
*/
|
||||
public boolean isAuto(Object bean)
|
||||
{
|
||||
for (Bean b : _beans)
|
||||
if (b._bean == bean)
|
||||
return b._managed==Managed.AUTO;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bean the bean to test
|
||||
* @return whether this aggregate contains the bean in auto state
|
||||
*/
|
||||
public boolean isUnmanaged(Object bean)
|
||||
{
|
||||
for (Bean b : _beans)
|
||||
if (b._bean == bean)
|
||||
return b._managed==Managed.UNMANAGED;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the given bean, detecting whether to manage it or not.
|
||||
* If the bean is a {@link LifeCycle}, then it will be managed if it is not
|
||||
|
@ -617,6 +640,7 @@ public class ContainerLifeCycle extends AbstractLifeCycle implements Container,
|
|||
try
|
||||
{
|
||||
dump(System.err, "");
|
||||
System.err.println(Dumpable.KEY);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
|
@ -628,48 +652,7 @@ public class ContainerLifeCycle extends AbstractLifeCycle implements Container,
|
|||
@ManagedOperation("Dump the object to a string")
|
||||
public String dump()
|
||||
{
|
||||
return dump(this);
|
||||
}
|
||||
|
||||
public static String dump(Dumpable dumpable)
|
||||
{
|
||||
StringBuilder b = new StringBuilder();
|
||||
try
|
||||
{
|
||||
dumpable.dump(b, "");
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
LOG.warn(e);
|
||||
}
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
public void dump(Appendable out) throws IOException
|
||||
{
|
||||
dump(out, "");
|
||||
}
|
||||
|
||||
protected void dumpThis(Appendable out) throws IOException
|
||||
{
|
||||
out.append(String.valueOf(this)).append(" - ").append(getState()).append("\n");
|
||||
}
|
||||
|
||||
public static void dumpObject(Appendable out, Object o) throws IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
String s = String.valueOf(o).replace("\r\n","|").replace("\n","|");
|
||||
|
||||
if (o instanceof LifeCycle)
|
||||
out.append(s).append(" - ").append((AbstractLifeCycle.getState((LifeCycle)o))).append("\n");
|
||||
else
|
||||
out.append(s).append("\n");
|
||||
}
|
||||
catch (Throwable th)
|
||||
{
|
||||
out.append(" => ").append(th.toString()).append('\n');
|
||||
}
|
||||
return Dumpable.dump(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -678,63 +661,41 @@ public class ContainerLifeCycle extends AbstractLifeCycle implements Container,
|
|||
dumpBeans(out,indent);
|
||||
}
|
||||
|
||||
protected void dumpBeans(Appendable out, String indent, Collection<?>... collections) throws IOException
|
||||
/**
|
||||
* Dump this object to an Appendable with no indent.
|
||||
* @param out The appendable to dump to.
|
||||
* @throws IOException May be thrown by the Appendable
|
||||
*/
|
||||
public void dump(Appendable out) throws IOException
|
||||
{
|
||||
dumpThis(out);
|
||||
int size = _beans.size();
|
||||
for (Collection<?> c : collections)
|
||||
size += c.size();
|
||||
int i = 0;
|
||||
for (Bean b : _beans)
|
||||
{
|
||||
++i;
|
||||
switch(b._managed)
|
||||
{
|
||||
case POJO:
|
||||
out.append(indent).append(" +- ");
|
||||
if (b._bean instanceof Dumpable)
|
||||
((Dumpable)b._bean).dump(out, indent + (i == size ? " " : " | "));
|
||||
else
|
||||
dumpObject(out, b._bean);
|
||||
break;
|
||||
|
||||
case MANAGED:
|
||||
out.append(indent).append(" += ");
|
||||
if (b._bean instanceof Dumpable)
|
||||
((Dumpable)b._bean).dump(out, indent + (i == size ? " " : " | "));
|
||||
else
|
||||
dumpObject(out, b._bean);
|
||||
break;
|
||||
|
||||
case UNMANAGED:
|
||||
out.append(indent).append(" +~ ");
|
||||
dumpObject(out, b._bean);
|
||||
break;
|
||||
|
||||
case AUTO:
|
||||
out.append(indent).append(" +? ");
|
||||
if (b._bean instanceof Dumpable)
|
||||
((Dumpable)b._bean).dump(out, indent + (i == size ? " " : " | "));
|
||||
else
|
||||
dumpObject(out, b._bean);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (Collection<?> c : collections)
|
||||
{
|
||||
for (Object o : c)
|
||||
{
|
||||
i++;
|
||||
out.append(indent).append(" +> ");
|
||||
if (o instanceof Dumpable)
|
||||
((Dumpable)o).dump(out, indent + (i == size ? " " : " | "));
|
||||
else
|
||||
dumpObject(out, o);
|
||||
}
|
||||
}
|
||||
dump(out, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Dump just this object, but not it's children. Typically used to
|
||||
* implement {@link #dump(Appendable, String)}
|
||||
* @param out The appendable to dump to
|
||||
* @throws IOException May be thrown by the Appendable
|
||||
*/
|
||||
@Deprecated
|
||||
protected void dumpThis(Appendable out) throws IOException
|
||||
{
|
||||
out.append(String.valueOf(this)).append(" - ").append(getState()).append("\n");
|
||||
}
|
||||
|
||||
|
||||
/** Dump this object, it's contained beans and additional items to an Appendable
|
||||
* @param out The appendable to dump to
|
||||
* @param indent The indent to apply after any new lines
|
||||
* @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
|
||||
{
|
||||
Dumpable.dumpObjects(out,indent,this, items);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void dump(Appendable out, String indent, Collection<?>... collections) throws IOException
|
||||
{
|
||||
if (collections.length == 0)
|
||||
|
@ -752,11 +713,7 @@ public class ContainerLifeCycle extends AbstractLifeCycle implements Container,
|
|||
{
|
||||
i++;
|
||||
out.append(indent).append(" +- ");
|
||||
|
||||
if (o instanceof Dumpable)
|
||||
((Dumpable)o).dump(out, indent + (i == size ? " " : " | "));
|
||||
else
|
||||
dumpObject(out, o);
|
||||
Dumpable.dumpObjects(out,indent + (i<size ? " | " : " "), o);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,13 @@
|
|||
package org.eclipse.jetty.util.component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.eclipse.jetty.util.annotation.ManagedObject;
|
||||
import org.eclipse.jetty.util.annotation.ManagedOperation;
|
||||
|
@ -26,8 +33,189 @@ import org.eclipse.jetty.util.annotation.ManagedOperation;
|
|||
@ManagedObject("Dumpable Object")
|
||||
public interface Dumpable
|
||||
{
|
||||
String KEY = "key: +- bean, += managed, +~ unmanaged, +? auto, +: iterable, +] array, +@ map, +> undefined";
|
||||
|
||||
@ManagedOperation(value="Dump the nested Object state as a String", impact="INFO")
|
||||
String dump();
|
||||
|
||||
default String dump()
|
||||
{
|
||||
return dump(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dump this object (and children) into an Appendable using the provided indent after any new lines.
|
||||
* The indent should not be applied to the first object dumped.
|
||||
* @param out The appendable to dump to
|
||||
* @param indent The indent to apply after any new lines.
|
||||
* @throws IOException
|
||||
*/
|
||||
void dump(Appendable out,String indent) throws IOException;
|
||||
|
||||
/**
|
||||
* Utility method to implement {@link #dump()} by calling {@link #dump(Appendable, String)}
|
||||
* @param dumpable The dumpable to dump
|
||||
* @return The dumped string
|
||||
*/
|
||||
static String dump(Dumpable dumpable)
|
||||
{
|
||||
StringBuilder b = new StringBuilder();
|
||||
try
|
||||
{
|
||||
dumpable.dump(b, "");
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
b.append(e.toString());
|
||||
}
|
||||
b.append(KEY);
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Dump just an Object (but not it's contained items) to an Appendable.
|
||||
* @param out The Appendable to dump to
|
||||
* @param o The object to dump.
|
||||
* @throws IOException May be thrown by the Appendable
|
||||
*/
|
||||
static void dumpObject(Appendable out, Object o) throws IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
String s;
|
||||
if (o==null)
|
||||
s = "null";
|
||||
else if (o instanceof Collection)
|
||||
s = String.format("%s@%x(size=%d)",o.getClass().getName(),o.hashCode(),((Collection)o).size());
|
||||
else if (o.getClass().isArray())
|
||||
s = String.format("%s@%x[size=%d]",o.getClass().getComponentType(),o.hashCode(), Array.getLength(o));
|
||||
else if (o instanceof Map)
|
||||
s = String.format("%s@%x{size=%d}",o.getClass().getName(),o.hashCode(),((Map<?,?>)o).size());
|
||||
else
|
||||
s = String.valueOf(o).replace("\r\n","|").replace("\n","|");
|
||||
|
||||
if (o instanceof LifeCycle)
|
||||
out.append(s).append(" - ").append((AbstractLifeCycle.getState((LifeCycle)o))).append("\n");
|
||||
else
|
||||
out.append(s).append("\n");
|
||||
}
|
||||
catch (Throwable th)
|
||||
{
|
||||
out.append("=>").append(th.toString()).append("\n");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dump an Object, it's contained items and additional items to an {@link Appendable}.
|
||||
* If the object in an {@link Iterable} or an {@link Array}, then its contained items
|
||||
* are also dumped.
|
||||
* @param out the Appendable to dump to
|
||||
* @param indent The indent to apply after any new lines
|
||||
* @param object The object to dump. If the object is an instance
|
||||
* of {@link Container}, {@link Stream}, {@link Iterable}, {@link Array} or {@link Map},
|
||||
* then children of the object a recursively dumped.
|
||||
* @param extraChildren Items to be dumped as children of the object, in addition to any discovered children of object
|
||||
* @throws IOException May be thrown by the Appendable
|
||||
*/
|
||||
static void dumpObjects(Appendable out, String indent, Object object, Object... extraChildren) throws IOException
|
||||
{
|
||||
dumpObject(out,object);
|
||||
|
||||
int size = extraChildren==null?0:extraChildren.length;
|
||||
|
||||
if (object instanceof Stream)
|
||||
object = ((Stream)object).toArray();
|
||||
if (object instanceof Array)
|
||||
object = Arrays.asList((Object[])object);
|
||||
|
||||
if (object instanceof Container)
|
||||
{
|
||||
Container container = (Container)object;
|
||||
ContainerLifeCycle containerLifeCycle = container instanceof ContainerLifeCycle ? (ContainerLifeCycle)container : null;
|
||||
for (Iterator<Object> i = container.getBeans().iterator(); i.hasNext();)
|
||||
{
|
||||
Object bean = i.next();
|
||||
String nextIndent = indent + ((i.hasNext() || size>0) ? "| " : " ");
|
||||
if (bean instanceof LifeCycle)
|
||||
{
|
||||
if (container.isManaged(bean))
|
||||
{
|
||||
out.append(indent).append("+=");
|
||||
if (bean instanceof Dumpable)
|
||||
((Dumpable)bean).dump(out,nextIndent);
|
||||
else
|
||||
dumpObjects(out, nextIndent, bean);
|
||||
}
|
||||
else if (containerLifeCycle != null && containerLifeCycle.isAuto(bean))
|
||||
{
|
||||
out.append(indent).append("+?");
|
||||
if (bean instanceof Dumpable)
|
||||
((Dumpable)bean).dump(out,nextIndent);
|
||||
else
|
||||
dumpObjects(out, nextIndent, bean);
|
||||
}
|
||||
else
|
||||
{
|
||||
out.append(indent).append("+~");
|
||||
dumpObject(out, bean);
|
||||
}
|
||||
}
|
||||
else if (containerLifeCycle != null && containerLifeCycle.isUnmanaged(bean))
|
||||
{
|
||||
out.append(indent).append("+~");
|
||||
dumpObject(out, bean);
|
||||
}
|
||||
else
|
||||
{
|
||||
out.append(indent).append("+-");
|
||||
if (bean instanceof Dumpable)
|
||||
((Dumpable)bean).dump(out,nextIndent);
|
||||
else
|
||||
dumpObjects(out, nextIndent, bean);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (object instanceof Iterable)
|
||||
{
|
||||
for (Iterator i = ((Iterable<?>)object).iterator(); i.hasNext();)
|
||||
{
|
||||
Object item = i.next();
|
||||
String nextIndent = indent + ((i.hasNext() || size>0) ? "| " : " ");
|
||||
out.append(indent).append("+:");
|
||||
if (item instanceof Dumpable)
|
||||
((Dumpable)item).dump(out,nextIndent);
|
||||
else
|
||||
dumpObjects(out,nextIndent, item);
|
||||
}
|
||||
}
|
||||
else if (object instanceof Map)
|
||||
{
|
||||
for (Iterator<? extends Map.Entry<?, ?>> i = ((Map<?,?>)object).entrySet().iterator(); i.hasNext();)
|
||||
{
|
||||
Map.Entry entry = i.next();
|
||||
String nextIndent = indent + ((i.hasNext() || size>0) ? "| " : " ");
|
||||
out.append(indent).append("+@").append(String.valueOf(entry.getKey())).append('=');
|
||||
Object item = entry.getValue();
|
||||
if (item instanceof Dumpable)
|
||||
((Dumpable)item).dump(out,nextIndent);
|
||||
else
|
||||
dumpObjects(out,nextIndent, item);
|
||||
}
|
||||
}
|
||||
|
||||
if (size==0)
|
||||
return;
|
||||
|
||||
int i = 0;
|
||||
for (Object item : extraChildren)
|
||||
{
|
||||
i++;
|
||||
String nextIndent = indent + (i<size ? "| " : " ");
|
||||
out.append(indent).append("+>");
|
||||
if (item instanceof Dumpable)
|
||||
((Dumpable)item).dump(out,nextIndent);
|
||||
else
|
||||
dumpObjects(out, nextIndent, item);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -34,22 +34,26 @@ public class DumpableCollection implements Dumpable
|
|||
_collection=collection;
|
||||
}
|
||||
|
||||
public DumpableCollection(String name,Object... items)
|
||||
public static DumpableCollection fromArray(String name, Object[] array)
|
||||
{
|
||||
this(name, items==null?Collections.emptyList():Arrays.asList(items));
|
||||
return new DumpableCollection(name,array==null?Collections.emptyList():Arrays.asList(array));
|
||||
}
|
||||
|
||||
public static DumpableCollection from(String name, Object... items)
|
||||
{
|
||||
return new DumpableCollection(name,items==null?Collections.emptyList():Arrays.asList(items));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String dump()
|
||||
{
|
||||
return ContainerLifeCycle.dump(this);
|
||||
return Dumpable.dump(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
out.append(_name).append(System.lineSeparator());
|
||||
if (_collection!=null)
|
||||
ContainerLifeCycle.dump(out,indent,_collection);
|
||||
Object[] array = _collection.toArray();
|
||||
Dumpable.dumpObjects(out,indent,_name + " size="+array.length, array);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,7 +76,6 @@ import org.eclipse.jetty.util.StringUtil;
|
|||
import org.eclipse.jetty.util.annotation.ManagedAttribute;
|
||||
import org.eclipse.jetty.util.annotation.ManagedObject;
|
||||
import org.eclipse.jetty.util.component.AbstractLifeCycle;
|
||||
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;
|
||||
|
@ -355,18 +354,26 @@ public class SslContextFactory extends AbstractLifeCycle implements Dumpable
|
|||
@Override
|
||||
public String dump()
|
||||
{
|
||||
return ContainerLifeCycle.dump(this);
|
||||
return Dumpable.dump(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
out.append(String.valueOf(this)).append(" trustAll=").append(Boolean.toString(_trustAll)).append(System.lineSeparator());
|
||||
|
||||
try
|
||||
{
|
||||
List<SslSelectionDump> selections = selectionDump();
|
||||
ContainerLifeCycle.dump(out, indent, selections);
|
||||
SSLEngine sslEngine = SSLContext.getDefault().createSSLEngine();
|
||||
Dumpable.dumpObjects(out, indent, this, "trustAll=" + _trustAll,
|
||||
new SslSelectionDump("Protocol",
|
||||
sslEngine.getSupportedProtocols(),
|
||||
sslEngine.getEnabledProtocols(),
|
||||
getExcludeProtocols(),
|
||||
getIncludeProtocols()),
|
||||
new SslSelectionDump("Cipher Suite",
|
||||
sslEngine.getSupportedCipherSuites(),
|
||||
sslEngine.getEnabledCipherSuites(),
|
||||
getExcludeCipherSuites(),
|
||||
getIncludeCipherSuites()));
|
||||
}
|
||||
catch (NoSuchAlgorithmException ignore)
|
||||
{
|
||||
|
|
|
@ -35,25 +35,23 @@ class SslSelectionDump extends ContainerLifeCycle implements Dumpable
|
|||
static class CaptionedList extends ArrayList<String> implements Dumpable
|
||||
{
|
||||
private final String caption;
|
||||
|
||||
|
||||
public CaptionedList(String caption)
|
||||
{
|
||||
this.caption = caption;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String dump()
|
||||
{
|
||||
return ContainerLifeCycle.dump(SslSelectionDump.CaptionedList.this);
|
||||
return Dumpable.dump(SslSelectionDump.CaptionedList.this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
out.append(caption);
|
||||
out.append(" (size=").append(Integer.toString(size())).append(")");
|
||||
out.append(System.lineSeparator());
|
||||
ContainerLifeCycle.dump(out, indent, this);
|
||||
Object[] array = toArray();
|
||||
Dumpable.dumpObjects(out, indent, caption + " size="+array.length, array);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -161,7 +159,7 @@ class SslSelectionDump extends ContainerLifeCycle implements Dumpable
|
|||
@Override
|
||||
public String dump()
|
||||
{
|
||||
return ContainerLifeCycle.dump(this);
|
||||
return Dumpable.dump(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.eclipse.jetty.util.thread;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
@ -353,23 +352,27 @@ public class ExecutorThreadPool extends ContainerLifeCycle implements ThreadPool
|
|||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
out.append(String.valueOf(thread.getId()))
|
||||
StringBuilder b = new StringBuilder();
|
||||
b.append(String.valueOf(thread.getId()))
|
||||
.append(" ")
|
||||
.append(thread.getName())
|
||||
.append(" p=").append(String.valueOf(thread.getPriority()))
|
||||
.append(" ")
|
||||
.append(known)
|
||||
.append(thread.getState().toString());
|
||||
|
||||
|
||||
if (isDetailedDump())
|
||||
{
|
||||
out.append(System.lineSeparator());
|
||||
if (known.isEmpty())
|
||||
ContainerLifeCycle.dump(out, indent, Arrays.asList(frames));
|
||||
Dumpable.dumpObjects(out, indent, b.toString(), (Object[])frames);
|
||||
else
|
||||
Dumpable.dumpObject(out, b.toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
out.append(" @ ").append(frames.length > 0 ? String.valueOf(frames[0]) : "<no_stack_frames>")
|
||||
.append(System.lineSeparator());
|
||||
b.append(" @ ").append(frames.length > 0 ? String.valueOf(frames[0]) : "<no_stack_frames>");
|
||||
Dumpable.dumpObject(out, b.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -385,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, Collections.singletonList(new DumpableCollection("jobs - size=" + jobs.size(), jobs)));
|
||||
dumpBeans(out, indent, threads, new DumpableCollection("jobs", jobs));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.eclipse.jetty.util.thread;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
@ -32,7 +31,6 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import org.eclipse.jetty.util.BlockingArrayQueue;
|
||||
import org.eclipse.jetty.util.ProcessorUtils;
|
||||
import org.eclipse.jetty.util.annotation.ManagedAttribute;
|
||||
import org.eclipse.jetty.util.annotation.ManagedObject;
|
||||
import org.eclipse.jetty.util.annotation.ManagedOperation;
|
||||
|
@ -606,12 +604,11 @@ public class QueuedThreadPool extends ContainerLifeCycle implements SizedThreadP
|
|||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
out.append(String.valueOf(thread.getId())).append(' ').append(thread.getName()).append(' ').append(known).append(thread.getState().toString());
|
||||
if (thread.getPriority()!=Thread.NORM_PRIORITY)
|
||||
out.append(" prio=").append(String.valueOf(thread.getPriority()));
|
||||
out.append(System.lineSeparator());
|
||||
String s = thread.getId()+" "+thread.getName()+" "+thread.getState()+" "+thread.getPriority();
|
||||
if (known.length()==0)
|
||||
ContainerLifeCycle.dump(out, indent, Arrays.asList(trace));
|
||||
Dumpable.dumpObjects(out, indent, s, (Object[])trace);
|
||||
else
|
||||
Dumpable.dumpObjects(out, indent, s);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -632,7 +629,7 @@ public class QueuedThreadPool extends ContainerLifeCycle implements SizedThreadP
|
|||
if (isDetailedDump())
|
||||
jobs = new ArrayList<>(getQueue());
|
||||
|
||||
dumpBeans(out, indent, threads, Collections.singletonList(new DumpableCollection("jobs - size=" + jobs.size(), jobs)));
|
||||
dumpBeans(out, indent, new DumpableCollection("threads",threads), new DumpableCollection("jobs", jobs));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,15 +19,12 @@
|
|||
package org.eclipse.jetty.util.thread;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.eclipse.jetty.util.component.AbstractLifeCycle;
|
||||
import org.eclipse.jetty.util.component.ContainerLifeCycle;
|
||||
import org.eclipse.jetty.util.component.Dumpable;
|
||||
|
||||
/**
|
||||
|
@ -109,19 +106,17 @@ public class ScheduledExecutorScheduler extends AbstractLifeCycle implements Sch
|
|||
@Override
|
||||
public String dump()
|
||||
{
|
||||
return ContainerLifeCycle.dump(this);
|
||||
return Dumpable.dump(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
ContainerLifeCycle.dumpObject(out, this);
|
||||
Thread thread = this.thread;
|
||||
if (thread != null)
|
||||
{
|
||||
List<StackTraceElement> frames = Arrays.asList(thread.getStackTrace());
|
||||
ContainerLifeCycle.dump(out, indent, frames);
|
||||
}
|
||||
if (thread == null)
|
||||
Dumpable.dumpObject(out, this);
|
||||
else
|
||||
Dumpable.dumpObjects(out,indent,this, (Object[])thread.getStackTrace());
|
||||
}
|
||||
|
||||
private static class ScheduledFutureTask implements Task
|
||||
|
|
|
@ -119,7 +119,7 @@ public class URIUtilCanonicalPathTest
|
|||
ArrayList<Arguments> ret = new ArrayList<>();
|
||||
for(String[] args: canonical)
|
||||
{
|
||||
ret.add(Arguments.of(args));
|
||||
ret.add(Arguments.of((Object[])args));
|
||||
}
|
||||
return ret.stream();
|
||||
}
|
||||
|
|
|
@ -215,59 +215,59 @@ public class ContainerLifeCycleTest
|
|||
a0.addBean(aa0);
|
||||
dump = trim(a0.dump());
|
||||
dump = check(dump, "ContainerLifeCycl");
|
||||
dump = check(dump, " +? ContainerLife");
|
||||
dump = check(dump, "+?ContainerLife");
|
||||
|
||||
ContainerLifeCycle aa1 = new ContainerLifeCycle();
|
||||
a0.addBean(aa1);
|
||||
dump = trim(a0.dump());
|
||||
dump = check(dump, "ContainerLifeCycl");
|
||||
dump = check(dump, " +? ContainerLife");
|
||||
dump = check(dump, " +? ContainerLife");
|
||||
dump = check(dump, "+?ContainerLife");
|
||||
dump = check(dump, "+?ContainerLife");
|
||||
dump = check(dump, "");
|
||||
|
||||
ContainerLifeCycle aa2 = new ContainerLifeCycle();
|
||||
a0.addBean(aa2, false);
|
||||
dump = trim(a0.dump());
|
||||
dump = check(dump, "ContainerLifeCycl");
|
||||
dump = check(dump, " +? ContainerLife");
|
||||
dump = check(dump, " +? ContainerLife");
|
||||
dump = check(dump, " +~ ContainerLife");
|
||||
dump = check(dump, "+?ContainerLife");
|
||||
dump = check(dump, "+?ContainerLife");
|
||||
dump = check(dump, "+~ContainerLife");
|
||||
dump = check(dump, "");
|
||||
|
||||
aa1.start();
|
||||
a0.start();
|
||||
dump = trim(a0.dump());
|
||||
dump = check(dump, "ContainerLifeCycl");
|
||||
dump = check(dump, " += ContainerLife");
|
||||
dump = check(dump, " +~ ContainerLife");
|
||||
dump = check(dump, " +~ ContainerLife");
|
||||
dump = check(dump, "+=ContainerLife");
|
||||
dump = check(dump, "+~ContainerLife");
|
||||
dump = check(dump, "+~ContainerLife");
|
||||
dump = check(dump, "");
|
||||
|
||||
a0.manage(aa1);
|
||||
a0.removeBean(aa2);
|
||||
dump = trim(a0.dump());
|
||||
dump = check(dump, "ContainerLifeCycl");
|
||||
dump = check(dump, " += ContainerLife");
|
||||
dump = check(dump, " += ContainerLife");
|
||||
dump = check(dump, "+=ContainerLife");
|
||||
dump = check(dump, "+=ContainerLife");
|
||||
dump = check(dump, "");
|
||||
|
||||
ContainerLifeCycle aaa0 = new ContainerLifeCycle();
|
||||
aa0.addBean(aaa0);
|
||||
dump = trim(a0.dump());
|
||||
dump = check(dump, "ContainerLifeCycl");
|
||||
dump = check(dump, " += ContainerLife");
|
||||
dump = check(dump, " | +~ Container");
|
||||
dump = check(dump, " += ContainerLife");
|
||||
dump = check(dump, "+=ContainerLife");
|
||||
dump = check(dump, "| +~Container");
|
||||
dump = check(dump, "+=ContainerLife");
|
||||
dump = check(dump, "");
|
||||
|
||||
ContainerLifeCycle aa10 = new ContainerLifeCycle();
|
||||
aa1.addBean(aa10, true);
|
||||
dump = trim(a0.dump());
|
||||
dump = check(dump, "ContainerLifeCycl");
|
||||
dump = check(dump, " += ContainerLife");
|
||||
dump = check(dump, " | +~ Container");
|
||||
dump = check(dump, " += ContainerLife");
|
||||
dump = check(dump, " += Container");
|
||||
dump = check(dump, "+=ContainerLife");
|
||||
dump = check(dump, "| +~Container");
|
||||
dump = check(dump, "+=ContainerLife");
|
||||
dump = check(dump, " +=Container");
|
||||
dump = check(dump, "");
|
||||
|
||||
final ContainerLifeCycle a1 = new ContainerLifeCycle();
|
||||
|
@ -280,63 +280,70 @@ public class ContainerLifeCycleTest
|
|||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
out.append(this.toString()).append("\n");
|
||||
dump(out, indent, TypeUtil.asList(new Object[]{a1, a2}), TypeUtil.asList(new Object[]{a3, a4}));
|
||||
Dumpable.dumpObjects(out, indent, this.toString(), TypeUtil.asList(new Object[]{a1, a2}), TypeUtil.asList(new Object[]{a3, a4}));
|
||||
}
|
||||
};
|
||||
a0.addBean(aa, true);
|
||||
|
||||
|
||||
dump = trim(a0.dump());
|
||||
dump = check(dump, "ContainerLifeCycl");
|
||||
dump = check(dump, " += ContainerLife");
|
||||
dump = check(dump, " | +~ Container");
|
||||
dump = check(dump, " += ContainerLife");
|
||||
dump = check(dump, " | += Container");
|
||||
dump = check(dump, " += ContainerLife");
|
||||
dump = check(dump, " +- Container");
|
||||
dump = check(dump, " +- Container");
|
||||
dump = check(dump, " +- Container");
|
||||
dump = check(dump, " +- Container");
|
||||
dump = check(dump, "+=ContainerLife");
|
||||
dump = check(dump, "| +~Container");
|
||||
dump = check(dump, "+=ContainerLife");
|
||||
dump = check(dump, "| +=Container");
|
||||
dump = check(dump, "+=ContainerLife");
|
||||
dump = check(dump, " +>java.util.Arrays$ArrayList");
|
||||
dump = check(dump, " | +:ContainerLifeCycle");
|
||||
dump = check(dump, " | +:ContainerLifeCycle");
|
||||
dump = check(dump, " +>java.util.Arrays$ArrayList");
|
||||
dump = check(dump, " +:ContainerLifeCycle");
|
||||
dump = check(dump, " +:ContainerLifeCycle");
|
||||
dump = check(dump, "");
|
||||
|
||||
a2.addBean(aa0, true);
|
||||
dump = trim(a0.dump());
|
||||
dump = check(dump, "ContainerLifeCycl");
|
||||
dump = check(dump, " += ContainerLife");
|
||||
dump = check(dump, " | +~ Container");
|
||||
dump = check(dump, " += ContainerLife");
|
||||
dump = check(dump, " | += Container");
|
||||
dump = check(dump, " += ContainerLife");
|
||||
dump = check(dump, " +- Container");
|
||||
dump = check(dump, " +- Container");
|
||||
dump = check(dump, " | += Conta");
|
||||
dump = check(dump, " | +~ C");
|
||||
dump = check(dump, " +- Container");
|
||||
dump = check(dump, " +- Container");
|
||||
dump = check(dump, "+=ContainerLife");
|
||||
dump = check(dump, "| +~Container");
|
||||
dump = check(dump, "+=ContainerLife");
|
||||
dump = check(dump, "| +=Container");
|
||||
dump = check(dump, "+=ContainerLife");
|
||||
dump = check(dump, " +>java.util.Arrays$ArrayList");
|
||||
dump = check(dump, " | +:ContainerLifeCycle");
|
||||
dump = check(dump, " | +:ContainerLifeCycle");
|
||||
dump = check(dump, " | +=Conta");
|
||||
dump = check(dump, " | +~C");
|
||||
dump = check(dump, " +>java.util.Arrays$ArrayList");
|
||||
dump = check(dump, " +:ContainerLifeCycle");
|
||||
dump = check(dump, " +:ContainerLifeCycle");
|
||||
dump = check(dump, "");
|
||||
|
||||
a2.unmanage(aa0);
|
||||
dump = trim(a0.dump());
|
||||
dump = check(dump, "ContainerLifeCycl");
|
||||
dump = check(dump, " += ContainerLife");
|
||||
dump = check(dump, " | +~ Container");
|
||||
dump = check(dump, " += ContainerLife");
|
||||
dump = check(dump, " | += Container");
|
||||
dump = check(dump, " += ContainerLife");
|
||||
dump = check(dump, " +- Container");
|
||||
dump = check(dump, " +- Container");
|
||||
dump = check(dump, " | +~ Conta");
|
||||
dump = check(dump, " +- Container");
|
||||
dump = check(dump, " +- Container");
|
||||
dump = check(dump, "+=ContainerLife");
|
||||
dump = check(dump, "| +~Container");
|
||||
dump = check(dump, "+=ContainerLife");
|
||||
dump = check(dump, "| +=Container");
|
||||
dump = check(dump, "+=ContainerLife");
|
||||
dump = check(dump, " +>java.util.Arrays$ArrayList");
|
||||
dump = check(dump, " | +:ContainerLifeCycle");
|
||||
dump = check(dump, " | +:ContainerLifeCycle");
|
||||
dump = check(dump, " | +~Conta");
|
||||
dump = check(dump, " +>java.util.Arrays$ArrayList");
|
||||
dump = check(dump, " +:ContainerLifeCycle");
|
||||
dump = check(dump, " +:ContainerLifeCycle");
|
||||
dump = check(dump, "");
|
||||
|
||||
a0.unmanage(aa);
|
||||
dump = trim(a0.dump());
|
||||
dump = check(dump, "ContainerLifeCycl");
|
||||
dump = check(dump, " += ContainerLife");
|
||||
dump = check(dump, " | +~ Container");
|
||||
dump = check(dump, " += ContainerLife");
|
||||
dump = check(dump, " | += Container");
|
||||
dump = check(dump, " +~ ContainerLife");
|
||||
dump = check(dump, "+=ContainerLife");
|
||||
dump = check(dump, "| +~Container");
|
||||
dump = check(dump, "+=ContainerLife");
|
||||
dump = check(dump, "| +=Container");
|
||||
dump = check(dump, "+~ContainerLife");
|
||||
dump = check(dump, "");
|
||||
}
|
||||
|
||||
|
|
|
@ -507,16 +507,13 @@ public class Configurations extends AbstractList<Configuration> implements Dumpa
|
|||
@Override
|
||||
public String dump()
|
||||
{
|
||||
return ContainerLifeCycle.dump(this);
|
||||
return Dumpable.dump(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
ContainerLifeCycle.dumpObject(out, this);
|
||||
ContainerLifeCycle.dump(out,indent,
|
||||
Collections.singletonList(new DumpableCollection("Known",Configurations.getKnown())),
|
||||
Collections.singletonList(new DumpableCollection("Configurations",this)));
|
||||
|
||||
Dumpable.dumpObjects(out,indent,this,
|
||||
new DumpableCollection("Known",Configurations.getKnown()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -970,13 +970,13 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
|
|||
}
|
||||
|
||||
dumpBeans(out,indent,
|
||||
Collections.singletonList(new ClassLoaderDump(getClassLoader())),
|
||||
Collections.singletonList(new DumpableCollection("Systemclasses "+this,system_classes)),
|
||||
Collections.singletonList(new DumpableCollection("Serverclasses "+this,server_classes)),
|
||||
Collections.singletonList(new DumpableCollection("Configurations "+this,_configurations.getConfigurations())),
|
||||
Collections.singletonList(new DumpableCollection("Handler attributes "+this,((AttributesMap)getAttributes()).getAttributeEntrySet())),
|
||||
Collections.singletonList(new DumpableCollection("Context attributes "+this,((Context)getServletContext()).getAttributeEntrySet())),
|
||||
Collections.singletonList(new DumpableCollection("Initparams "+this,getInitParams().entrySet()))
|
||||
new ClassLoaderDump(getClassLoader()),
|
||||
new DumpableCollection("Systemclasses "+this,system_classes),
|
||||
new DumpableCollection("Serverclasses "+this,server_classes),
|
||||
new DumpableCollection("Configurations "+this,_configurations),
|
||||
new DumpableCollection("Handler attributes "+this,((AttributesMap)getAttributes()).getAttributeEntrySet()),
|
||||
new DumpableCollection("Context attributes "+this,((Context)getServletContext()).getAttributeEntrySet()),
|
||||
new DumpableCollection("Initparams "+this,getInitParams().entrySet())
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -705,13 +705,6 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketCont
|
|||
this.sessionFactory = sessionFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
dumpThis(out);
|
||||
dump(out,indent,getOpenSessions());
|
||||
}
|
||||
|
||||
public HttpClient getHttpClient()
|
||||
{
|
||||
return this.httpClient;
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.net.SocketException;
|
|||
import java.net.SocketTimeoutException;
|
||||
import java.net.URI;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
@ -43,6 +44,7 @@ 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;
|
||||
import org.eclipse.jetty.util.thread.ThreadClassLoaderScope;
|
||||
|
@ -286,17 +288,8 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
|
|||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
dumpThis(out);
|
||||
out.append(indent).append(" +- endpoint : ").append(endpoint.getClass().getName()).append('@').append(Integer.toHexString(endpoint.hashCode()));
|
||||
out.append(indent).append(" +- outgoingHandler : ");
|
||||
if (outgoingHandler instanceof Dumpable)
|
||||
{
|
||||
((Dumpable) outgoingHandler).dump(out, indent + " ");
|
||||
}
|
||||
else
|
||||
{
|
||||
out.append(outgoingHandler.toString()).append(System.lineSeparator());
|
||||
}
|
||||
dumpBeans(out,indent,
|
||||
DumpableCollection.from("outgoing", outgoingHandler));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.eclipse.jetty.io.ByteBufferPool;
|
|||
import org.eclipse.jetty.util.annotation.ManagedAttribute;
|
||||
import org.eclipse.jetty.util.annotation.ManagedObject;
|
||||
import org.eclipse.jetty.util.component.AbstractLifeCycle;
|
||||
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;
|
||||
|
@ -58,7 +57,7 @@ public abstract class AbstractExtension extends AbstractLifeCycle implements Dum
|
|||
@Override
|
||||
public String dump()
|
||||
{
|
||||
return ContainerLifeCycle.dump(this);
|
||||
return Dumpable.dump(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -36,7 +36,6 @@ import org.eclipse.jetty.io.ByteBufferPool;
|
|||
import org.eclipse.jetty.io.Connection;
|
||||
import org.eclipse.jetty.io.EndPoint;
|
||||
import org.eclipse.jetty.util.BufferUtil;
|
||||
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;
|
||||
|
@ -563,7 +562,7 @@ public abstract class AbstractWebSocketConnection extends AbstractConnection imp
|
|||
@Override
|
||||
public String dump()
|
||||
{
|
||||
return ContainerLifeCycle.dump(this);
|
||||
return Dumpable.dump(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -39,7 +39,6 @@ import org.eclipse.jetty.servlet.FilterHolder;
|
|||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
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.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
@ -275,14 +274,13 @@ public class WebSocketUpgradeFilter implements Filter, MappedWebSocketCreator, D
|
|||
@Override
|
||||
public String dump()
|
||||
{
|
||||
return ContainerLifeCycle.dump(this);
|
||||
return Dumpable.dump(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
out.append(indent).append(" +- configuration=").append(configuration.toString()).append("\n");
|
||||
configuration.dump(out, indent);
|
||||
Dumpable.dumpObjects(out,indent,this,configuration);
|
||||
}
|
||||
|
||||
public WebSocketServletFactory getFactory()
|
||||
|
|
Loading…
Reference in New Issue