@Test public void testCallingThreadIsBlockedUntilAllTaskCompletes() throws InterruptedException { long ts = Time.now(); service.await(new Runnable() { @Override public void run() { Threads.sleep(100); } }, new Runnable() { @Override public void run() { Threads.sleep(50); } }, new Runnable() { @Override public void run() { Threads.sleep(150); } }); long elapsed = Time.now() - ts; Assert.assertTrue(TimeUnit.MILLISECONDS.convert(elapsed, TimeUnit.MICROSECONDS) >= 150); Assert.assertTrue(TimeUnit.MILLISECONDS.convert(elapsed, TimeUnit.MICROSECONDS) <= 300); }
public final boolean await(Runnable... tasks) throws InterruptedException { return await((task, error) -> { throw CheckedExceptions.wrapAsRuntimeException(error); }, tasks); }
AwaitableExecutorService extends ForwardingExecutorService { public final boolean await(Runnable... tasks) throws InterruptedException { return await((task, error) -> { throw CheckedExceptions.wrapAsRuntimeException(error); }, tasks); } }
AwaitableExecutorService extends ForwardingExecutorService { public final boolean await(Runnable... tasks) throws InterruptedException { return await((task, error) -> { throw CheckedExceptions.wrapAsRuntimeException(error); }, tasks); } AwaitableExecutorService(ExecutorService delegate); }
AwaitableExecutorService extends ForwardingExecutorService { public final boolean await(Runnable... tasks) throws InterruptedException { return await((task, error) -> { throw CheckedExceptions.wrapAsRuntimeException(error); }, tasks); } AwaitableExecutorService(ExecutorService delegate); final boolean await(Runnable... tasks); final boolean await(BiConsumer<Runnable, Throwable> errorHandler,
            Runnable... tasks); }
AwaitableExecutorService extends ForwardingExecutorService { public final boolean await(Runnable... tasks) throws InterruptedException { return await((task, error) -> { throw CheckedExceptions.wrapAsRuntimeException(error); }, tasks); } AwaitableExecutorService(ExecutorService delegate); final boolean await(Runnable... tasks); final boolean await(BiConsumer<Runnable, Throwable> errorHandler,
            Runnable... tasks);  }