Package org.apache.hadoop.test.MultithreadedTestUtil

Examples of org.apache.hadoop.test.MultithreadedTestUtil.TestContext.waitFor()


      });
    }
    assertEquals(0, threadsRun.get());
    ctx.startThreads();
    long st = System.currentTimeMillis();
    ctx.waitFor(30000);
    long et = System.currentTimeMillis();

    // All threads should have run
    assertEquals(3, threadsRun.get());
    // Test shouldn't have waited the full 30 seconds, since
View Full Code Here


      }
    });
    ctx.startThreads();
    long st = System.currentTimeMillis();
    try {
      ctx.waitFor(30000);
      fail("waitFor did not throw");
    } catch (RuntimeException rte) {
      // expected
      assertEquals(FAIL_MSG, rte.getCause().getMessage());
    }
View Full Code Here

      }
    });
    ctx.startThreads();
    long st = System.currentTimeMillis();
    try {
      ctx.waitFor(30000);
      fail("waitFor did not throw");
    } catch (RuntimeException rte) {
      // expected
      assertEquals("my ioe", rte.getCause().getMessage());
    }
View Full Code Here

        // Loop printing results every second until the specified
        // time has elapsed
        for (int i = 0; i < opts.secondsToRun ; i++) {
          long st = System.nanoTime();
          ctx.waitFor(1000);
          long et = System.nanoTime();
          long ct = callCount.getAndSet(0);
          totalCalls += ct;
          double callsPerSec = (ct * 1000000000)/(et - st);
          System.out.println("Calls per second: " + callsPerSec);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.