Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimone Bordet2015-12-22 20:09:57 +0000
committerSimone Bordet2015-12-23 10:08:25 +0000
commitb7ab9e0a22f62647c8745f106d620ee307e7a2e7 (patch)
treefcbdefb150288417f2cf8468012c80cd86436e93 /jetty-http2/http2-server/src
parent19d6e36ab961b9b8db97c66ebde973f36e37f959 (diff)
downloadorg.eclipse.jetty.project-b7ab9e0a22f62647c8745f106d620ee307e7a2e7.tar.gz
org.eclipse.jetty.project-b7ab9e0a22f62647c8745f106d620ee307e7a2e7.tar.xz
org.eclipse.jetty.project-b7ab9e0a22f62647c8745f106d620ee307e7a2e7.zip
484818 - Expose interesting HTTP/2 attributes and operations via JMX.
Initial work to expose already existing attributes on the server.
Diffstat (limited to 'jetty-http2/http2-server/src')
-rw-r--r--jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/AbstractHTTP2ServerConnectionFactory.java29
1 files changed, 27 insertions, 2 deletions
diff --git a/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/AbstractHTTP2ServerConnectionFactory.java b/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/AbstractHTTP2ServerConnectionFactory.java
index f625aaa232..61f581c201 100644
--- a/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/AbstractHTTP2ServerConnectionFactory.java
+++ b/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/AbstractHTTP2ServerConnectionFactory.java
@@ -31,15 +31,21 @@ import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.server.AbstractConnectionFactory;
import org.eclipse.jetty.server.Connector;
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.LifeCycle;
+@ManagedObject
public abstract class AbstractHTTP2ServerConnectionFactory extends AbstractConnectionFactory
{
+ private final Connection.Listener connectionListener = new ConnectionListener();
+ private final HttpConfiguration httpConfiguration;
private int maxDynamicTableSize = 4096;
private int initialStreamSendWindow = FlowControlStrategy.DEFAULT_WINDOW_SIZE;
private int maxConcurrentStreams = -1;
private int maxHeaderBlockFragment = 0;
- private final HttpConfiguration httpConfiguration;
public AbstractHTTP2ServerConnectionFactory(@Name("config") HttpConfiguration httpConfiguration)
{
@@ -50,8 +56,10 @@ public abstract class AbstractHTTP2ServerConnectionFactory extends AbstractConne
{
super(protocols);
this.httpConfiguration = Objects.requireNonNull(httpConfiguration);
+ addBean(httpConfiguration);
}
+ @ManagedAttribute("The HPACK dynamic table maximum size")
public int getMaxDynamicTableSize()
{
return maxDynamicTableSize;
@@ -62,6 +70,7 @@ public abstract class AbstractHTTP2ServerConnectionFactory extends AbstractConne
this.maxDynamicTableSize = maxDynamicTableSize;
}
+ @ManagedAttribute("The initial size of stream's flow control send window")
public int getInitialStreamSendWindow()
{
return initialStreamSendWindow;
@@ -72,6 +81,7 @@ public abstract class AbstractHTTP2ServerConnectionFactory extends AbstractConne
this.initialStreamSendWindow = initialStreamSendWindow;
}
+ @ManagedAttribute("The max number of concurrent streams per session")
public int getMaxConcurrentStreams()
{
return maxConcurrentStreams;
@@ -116,7 +126,7 @@ public abstract class AbstractHTTP2ServerConnectionFactory extends AbstractConne
ServerParser parser = newServerParser(connector, session);
HTTP2Connection connection = new HTTP2ServerConnection(connector.getByteBufferPool(), connector.getExecutor(),
endPoint, httpConfiguration, parser, session, getInputBufferSize(), listener);
-
+ connection.addListener(connectionListener);
return configure(connection, connector, endPoint);
}
@@ -131,4 +141,19 @@ public abstract class AbstractHTTP2ServerConnectionFactory extends AbstractConne
{
return new ServerParser(connector.getByteBufferPool(), listener, getMaxDynamicTableSize(), getHttpConfiguration().getRequestHeaderSize());
}
+
+ private static class ConnectionListener extends ContainerLifeCycle implements Connection.Listener
+ {
+ @Override
+ public void onOpened(Connection connection)
+ {
+ addManaged((LifeCycle)((HTTP2Connection)connection).getSession());
+ }
+
+ @Override
+ public void onClosed(Connection connection)
+ {
+ removeBean(((HTTP2Connection)connection).getSession());
+ }
+ }
}

Back to the top