@BeforeClass public static void initJetty() throws Exception { jetty = new JettyDistro(JmxServiceTest.class); jetty.delete("contexts/javadoc.xml"); jetty.overlayConfig("monitor"); jetty.start(); JMXMonitor.setServiceUrl(jetty.getJmxUrl()); }
@Test public void testThreadPoolMXBean() throws Exception { final int threadCount = 100; final long requestCount = 100; final String requestUrl = jetty.getBaseUri().resolve("d.txt").toASCIIString(); final CountDownLatch gate = new CountDownLatch(threadCount); ThreadPool worker = new ExecutorThreadPool(threadCount, threadCount, 60, TimeUnit.SECONDS); for (int idx = 0; idx < threadCount; idx++) { worker.dispatch( new Runnable() { public void run() { runTest(requestUrl, requestCount); gate.countDown(); } }); Thread.sleep(100); } gate.await(); assertTrue(true); }
@AfterClass public static void shutdownJetty() throws Exception { if (jetty != null) { jetty.stop(); } }