Package org.apache.hadoop.hbase
Class MultithreadedTestUtil
java.lang.Object
org.apache.hadoop.hbase.MultithreadedTestUtil
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA test thread that performs a repeating operation.static classstatic classA thread that can be added to a test context, and properly passes exceptions through. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidassertOnFutures(List<Future<?>> threadResults) Verify that no assertions have failed inside a future.
-
Field Details
-
LOG
-
-
Constructor Details
-
MultithreadedTestUtil
public MultithreadedTestUtil()
-
-
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 futuresExecutionException- If an exception other than AssertionError occurs inside any of the futures
-