diff --git a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/DeploymentManagerLifeCyclePathTest.java b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/DeploymentManagerLifeCyclePathTest.java
index 3907186a44e..49dd8d08a89 100644
--- a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/DeploymentManagerLifeCyclePathTest.java
+++ b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/DeploymentManagerLifeCyclePathTest.java
@@ -27,7 +27,6 @@ import javax.management.ObjectName;
import org.eclipse.jetty.jmx.MBeanContainer;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
-import org.eclipse.jetty.toolchain.jmx.JmxServiceConnection;
import org.junit.Test;
public class DeploymentManagerLifeCyclePathTest
diff --git a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/JmxServiceConnection.java b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/JmxServiceConnection.java
new file mode 100644
index 00000000000..c59c87585bc
--- /dev/null
+++ b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/JmxServiceConnection.java
@@ -0,0 +1,154 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+package org.eclipse.jetty.deploy;
+
+import java.io.IOException;
+import java.lang.management.ManagementFactory;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerConnection;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXConnectorServer;
+import javax.management.remote.JMXConnectorServerFactory;
+import javax.management.remote.JMXServiceURL;
+
+import org.eclipse.jetty.toolchain.test.IO;
+
+/**
+ * JmxServiceConnection
+ *
+ * Provides ability to create a connection to either an external
+ * JMX server, or a loopback connection to the internal one.
+ */
+public class JmxServiceConnection
+{
+ private String serviceUrl;
+ private MBeanServer server;
+ private JMXConnectorServer connectorServer;
+ private JMXConnector serverConnector;
+ private MBeanServerConnection serviceConnection;
+
+ /**
+ * Construct a loopback connection to an internal server
+ */
+ public JmxServiceConnection()
+ {
+ this(null);
+ }
+
+ /**
+ * Construct a connection to specified server
+ *
+ * @param url
+ * URL of JMX server
+ */
+ public JmxServiceConnection(String url)
+ {
+ serviceUrl = url;
+ }
+
+ /**
+ * Retrieve an external URL for the JMX server
+ *
+ * @return service URL
+ */
+ public String getServiceUrl()
+ {
+ return serviceUrl;
+ }
+
+ /* ------------------------------------------------------------ */
+ /**
+ * Retrieve a connection to MBean server
+ *
+ * @return connection to MBean server
+ */
+ public MBeanServerConnection getConnection()
+ {
+ return serviceConnection;
+ }
+
+ public void connect() throws IOException
+ {
+ if (serviceConnection == null)
+ {
+ if (serviceUrl == null)
+ {
+ openLoopbackConnection();
+ }
+ else
+ {
+ openServerConnection(serviceUrl);
+ }
+ }
+ }
+
+ /**
+ * Open a loopback connection to local JMX server
+ *
+ * @throws IOException
+ */
+ private void openLoopbackConnection() throws IOException
+ {
+ server = ManagementFactory.getPlatformMBeanServer();
+
+ JMXServiceURL serviceUrl = new JMXServiceURL("service:jmx:rmi://");
+ connectorServer = JMXConnectorServerFactory.newJMXConnectorServer(serviceUrl,null,server);
+ connectorServer.start();
+
+ this.serviceUrl = connectorServer.getAddress().toString();
+
+ serverConnector = JMXConnectorFactory.connect(connectorServer.getAddress());
+ serviceConnection = serverConnector.getMBeanServerConnection();
+ }
+
+ /**
+ * Open a connection to remote JMX server
+ *
+ * @param url
+ * @throws IOException
+ */
+ private void openServerConnection(String url) throws IOException
+ {
+ serviceUrl = url;
+ serverConnector = JMXConnectorFactory.connect(new JMXServiceURL(serviceUrl));
+ serviceConnection = serverConnector.getMBeanServerConnection();
+ }
+
+ /**
+ * Close the connections
+ */
+ public void disconnect()
+ {
+ IO.close(serverConnector);
+
+ if (connectorServer != null)
+ {
+ try
+ {
+ connectorServer.stop();
+ }
+ catch (Exception ignore)
+ {
+ /* ignore */
+ }
+ }
+ }
+}
diff --git a/jetty-util/pom.xml b/jetty-util/pom.xml
index fd944c1c363..59d87cf6db3 100644
--- a/jetty-util/pom.xml
+++ b/jetty-util/pom.xml
@@ -75,6 +75,11 @@
javax.servlet-api
provided
+
+ org.eclipse.jetty.toolchain
+ jetty-perf-helper
+ test
+
org.eclipse.jetty.toolchain
jetty-test-helper
diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/thread/SchedulerTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/thread/SchedulerTest.java
index f1b2af71637..6813c64b78b 100644
--- a/jetty-util/src/test/java/org/eclipse/jetty/util/thread/SchedulerTest.java
+++ b/jetty-util/src/test/java/org/eclipse/jetty/util/thread/SchedulerTest.java
@@ -26,7 +26,7 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
-import org.eclipse.jetty.toolchain.test.BenchmarkHelper;
+import org.eclipse.jetty.toolchain.perf.PlatformMonitor;
import org.eclipse.jetty.toolchain.test.annotation.Slow;
import org.eclipse.jetty.util.statistic.SampleStatistic;
import org.hamcrest.Matchers;
@@ -218,11 +218,13 @@ public class SchedulerTest
public void testBenchmark() throws Exception
{
schedule(2000,10000,2000,50);
- BenchmarkHelper benchmark = new BenchmarkHelper();
- benchmark.startStatistics();
+ PlatformMonitor benchmark = new PlatformMonitor();
+ PlatformMonitor.Start start = benchmark.start();
+ System.err.println(start);
System.err.println(_scheduler);
schedule(2000,30000,2000,50);
- benchmark.stopStatistics();
+ PlatformMonitor.Stop stop = benchmark.stop();
+ System.err.println(stop);
}
private void schedule(int threads,final int duration, final int delay, final int interval) throws Exception
diff --git a/pom.xml b/pom.xml
index 7a3d3ff8c9a..f509f774c68 100644
--- a/pom.xml
+++ b/pom.xml
@@ -649,7 +649,12 @@
org.eclipse.jetty.toolchain
jetty-test-helper
- 2.7
+ 3.0
+
+
+ org.eclipse.jetty.toolchain
+ jetty-perf-helper
+ 1.0.5
org.slf4j
@@ -669,7 +674,7 @@
junit
junit
- 4.11
+ 4.12
org.hamcrest