From e56d91196d6a669b04dc499cfc56329cbccd6297 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Wed, 28 Aug 2019 12:31:33 -0500 Subject: [PATCH] Issue #4020 - Adding JMX to BrowserDebugTool to test dump Signed-off-by: Joakim Erdfelt --- jetty-websocket/websocket-server/pom.xml | 6 ++++++ .../jetty/websocket/server/browser/BrowserDebugTool.java | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/jetty-websocket/websocket-server/pom.xml b/jetty-websocket/websocket-server/pom.xml index e406f52595c..c3e50f78364 100644 --- a/jetty-websocket/websocket-server/pom.xml +++ b/jetty-websocket/websocket-server/pom.xml @@ -107,6 +107,12 @@ tests test + + org.eclipse.jetty + jetty-jmx + ${project.version} + test + org.eclipse.jetty.toolchain jetty-test-helper diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/browser/BrowserDebugTool.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/browser/BrowserDebugTool.java index 751e5b5479e..2cd9a7fb9f6 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/browser/BrowserDebugTool.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/browser/BrowserDebugTool.java @@ -20,12 +20,14 @@ package org.eclipse.jetty.websocket.server.browser; import java.io.FileNotFoundException; import java.io.IOException; +import java.lang.management.ManagementFactory; import java.net.MalformedURLException; import java.net.URISyntaxException; import java.nio.file.Path; import java.util.ArrayList; import java.util.List; +import org.eclipse.jetty.jmx.MBeanContainer; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.server.handler.ResourceHandler; @@ -131,10 +133,17 @@ public class BrowserDebugTool implements WebSocketCreator public void prepare(int port) throws IOException, URISyntaxException { server = new Server(); + + // Setup JMX + MBeanContainer mbContainer = new MBeanContainer(ManagementFactory.getPlatformMBeanServer()); + server.addBean(mbContainer, true); + + // Setup Connector connector = new ServerConnector(server); connector.setPort(port); server.addConnector(connector); + // Setup WebSocket WebSocketHandler wsHandler = new WebSocketHandler() { @Override