Ejemplo n.º 1
0
  @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());
  }
Ejemplo n.º 2
0
 @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);
 }
Ejemplo n.º 3
0
 @AfterClass
 public static void shutdownJetty() throws Exception {
   if (jetty != null) {
     jetty.stop();
   }
 }