Class MultithreadedTestUtil

java.lang.Object
org.apache.hadoop.hbase.MultithreadedTestUtil

public abstract class MultithreadedTestUtil extends Object
  • Field Details

    • LOG

      private static final org.slf4j.Logger LOG
  • Constructor Details

  • Method Details

    • assertOnFutures

      public static void assertOnFutures(List<Future<?>> threadResults) throws InterruptedException, ExecutionException
      Verify that no assertions have failed inside a future. Used for unit tests that spawn threads. E.g.,

         List<Future<Void>> results = Lists.newArrayList();
         Future<Void> f = executor.submit(new Callable<Void> {
           public Void call() {
             assertTrue(someMethod());
           }
         });
         results.add(f);
         assertOnFutures(results);
       
      Parameters:
      threadResults - A list of futures
      Throws:
      InterruptedException - If interrupted when waiting for a result from one of the futures
      ExecutionException - If an exception other than AssertionError occurs inside any of the futures