@Override public void join() throws ExecutionException, InterruptedException { fiber.join(); }
@Override public void join(long timeout, TimeUnit unit) throws ExecutionException, InterruptedException, TimeoutException { fiber.join(timeout, unit); }
@Override public void join() throws ExecutionException, InterruptedException { fiber.join(); }
@Override public void join(long timeout, TimeUnit unit) throws ExecutionException, InterruptedException, TimeoutException { fiber.join(timeout, unit); }
/** * Runs an action in a new fiber and awaits the fiber's termination. * * @param scheduler the {@link FiberScheduler} to use when scheduling the fiber. * @param target the operation * @throws ExecutionException * @throws InterruptedException */ public static void runInFiber(FiberScheduler scheduler, SuspendableRunnable target) throws ExecutionException, InterruptedException { new Fiber<Void>(scheduler, target).start().join(); }
/** * Runs an action in a new fiber and awaits the fiber's termination. * Unlike {@link #runInFiber(FiberScheduler, SuspendableRunnable) runInFiber} this method does not throw {@link ExecutionException}, but wraps * any checked exception thrown by the operation in a {@link RuntimeException}. * * @param scheduler the {@link FiberScheduler} to use when scheduling the fiber. * @param target the operation * @throws InterruptedException */ public static void runInFiberRuntime(FiberScheduler scheduler, SuspendableRunnable target) throws InterruptedException { try { new Fiber<Void>(scheduler, target).start().join(); } catch (ExecutionException e) { throw Exceptions.rethrow(e.getCause()); } }
/** * Runs an action in a new fiber and awaits the fiber's termination. * Unlike {@link #runInFiber(SuspendableRunnable) runInFiber} this method does not throw {@link ExecutionException}, but wraps * any checked exception thrown by the operation in a {@link RuntimeException}, unless it is of the given {@code exception type}, in * which case the checked exception is thrown as-is. * * @param scheduler the {@link FiberScheduler} to use when scheduling the fiber. * @param target the operation * @param exceptionType a checked exception type that will not be wrapped if thrown by the operation, but thrown as-is. * @throws InterruptedException */ public static <X extends Exception> void runInFiberChecked(FiberScheduler scheduler, SuspendableRunnable target, Class<X> exceptionType) throws X, InterruptedException { try { new Fiber<Void>(scheduler, target).start().join(); } catch (ExecutionException ex) { throw throwChecked(ex, exceptionType); } }
f.join(); } else collector.join();