change addToAllConnectors method to addBeanToAllConnectors

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2020-08-25 10:22:18 +10:00
parent 623d1be7c7
commit 8faa71818f
5 changed files with 10 additions and 10 deletions

View File

@ -180,7 +180,7 @@ public class LikeJettyXml
StatisticsHandler stats = new StatisticsHandler();
stats.setHandler(server.getHandler());
server.setHandler(stats);
server.addToAllConnectors(new ConnectionStatistics());
server.addBeanToAllConnectors(new ConnectionStatistics());
// === Rewrite Handler
RewriteHandler rewrite = new RewriteHandler();

View File

@ -45,7 +45,7 @@ public class OneServletContextJmxStats
context.addServlet(DefaultServlet.class, "/");
// Add Connector Statistics tracking to all connectors
server.addToAllConnectors(new ConnectionStatistics());
server.addBeanToAllConnectors(new ConnectionStatistics());
return server;
}

View File

@ -8,7 +8,7 @@
<New id="StatsHandler" class="org.eclipse.jetty.server.handler.StatisticsHandler"></New>
</Arg>
</Call>
<Call name="addToAllConnectors">
<Call name="addBeanToAllConnectors">
<Arg>
<New class="org.eclipse.jetty.io.ConnectionStatistics"/>
</Arg>

View File

@ -267,15 +267,16 @@ public class Server extends HandlerWrapper implements Attributes
}
/**
* Add a {@link Connection.Listener} as a bean to all connectors on the server, this
* will register the listener with all connections accepted by the connectors.
* @param listener the listener to be added.
* Add a bean to all connectors on the server.
* If the bean is an instance of {@link Connection.Listener} it will also be
* registered as a listener on all connections accepted by the connectors.
* @param bean the bean to be added.
*/
public void addToAllConnectors(Connection.Listener listener)
public void addBeanToAllConnectors(Object bean)
{
for (Connector connector : getConnectors())
{
connector.addBean(listener);
connector.addBean(bean);
}
}

View File

@ -18,7 +18,6 @@
package org.eclipse.jetty.server;
import org.eclipse.jetty.io.Connection;
import org.eclipse.jetty.io.ConnectionStatistics;
@Deprecated
@ -26,7 +25,7 @@ public class ServerConnectionStatistics extends ConnectionStatistics
{
/**
* @param server the server to use to add {@link ConnectionStatistics} to all Connectors.
* @deprecated use {@link Server#addToAllConnectors(Connection.Listener)} instead.
* @deprecated use {@link Server#addBeanToAllConnectors(Object)} instead.
*/
public static void addToAllConnectors(Server server)
{