@Override public V run() throws SuspendExecution, InterruptedException { try { return callable.call(); } catch (Exception e) { throw Exceptions.rethrow(e); } } };
private StackTraceElement getStackTraceElement0(int i) { try { return (StackTraceElement) getStackTraceElement.invoke(t, i); } catch (IllegalAccessException e) { throw new AssertionError(e); } catch (InvocationTargetException e) { throw rethrow(e); } }
private int getStackTraceDepth0() { try { return (Integer) getStackTraceDepth.invoke(t); } catch (IllegalAccessException e) { throw new AssertionError(e); } catch (InvocationTargetException e) { throw rethrow(e); } }
public static <X extends Throwable> RuntimeException rethrowUnwrap(Throwable t, Class<X> exceptionClass) throws X { Throwable t1 = unwrap(t); if (exceptionClass.isInstance(t1)) throw exceptionClass.cast(t1); throw rethrow(t1); }
private static <V, X extends Exception> RuntimeException throwChecked(ExecutionException ex, Class<X> exceptionType) throws X { Throwable t = Exceptions.unwrap(ex); if (exceptionType.isInstance(t)) throw exceptionType.cast(t); else throw Exceptions.rethrow(t); }
public static <X1 extends Throwable, X2 extends Throwable> RuntimeException rethrowUnwrap(Throwable t, Class<X1> exceptionClass1, Class<X2> exceptionClass2) throws X1, X2 { Throwable t1 = unwrap(t); if (exceptionClass1.isInstance(t1)) throw exceptionClass1.cast(t1); if (exceptionClass2.isInstance(t1)) throw exceptionClass2.cast(t1); throw rethrow(t1); }
@Override public void run() { try { callable.run(); } catch (SuspendExecution ex) { throw new AssertionError(ex); } catch (InterruptedException ex) { } catch (Exception e) { throw Exceptions.rethrow(e); } } }
public static <X1 extends Throwable, X2 extends Throwable> RuntimeException rethrowUnwrap(Throwable t, Class<X1> exceptionClass1, Class<X2> exceptionClass2) throws X1, X2 { Throwable t1 = unwrap(t); if (exceptionClass1.isInstance(t1)) throw exceptionClass1.cast(t1); if (exceptionClass2.isInstance(t1)) throw exceptionClass2.cast(t1); throw rethrow(t1); }
protected void onException(Throwable t) { record("doExec", "exception in %s - %s, %s", this, t, t.getStackTrace()); throw Exceptions.rethrow(t); }
protected void onException(Throwable t) { if (future != null) future.setException(t); else throw Exceptions.rethrow(t); }
@Override public void run() { try { runnable.run(); } catch (SuspendExecution ex) { throw new AssertionError(ex); } catch (InterruptedException ex) { } catch (Exception e) { throw Exceptions.rethrow(e); } } }
public static <X extends Throwable> RuntimeException rethrowUnwrap(Throwable t, Class<X> exceptionClass) throws X { Throwable t1 = unwrap(t); if (exceptionClass.isInstance(t1)) throw exceptionClass.cast(t1); throw rethrow(t1); }
public static RuntimeException rethrowUnwrap(Throwable t) { throw rethrow(unwrap(t)); }
protected void onException(Throwable t) { record("doExec", "exception in %s - %s, %s", this, t, t.getStackTrace()); throw Exceptions.rethrow(t); }
@Override @SuppressWarnings("UseSpecificCatch") public V run() throws SuspendExecution, InterruptedException { try { return callable.call(); } catch (final Exception e) { // SuspendExecution will be handled separately by instrumentation if (e instanceof InterruptedException) throw (InterruptedException) e; else throw Exceptions.rethrow(e); } } };
public static RuntimeException rethrowUnwrap(Throwable t) { throw rethrow(unwrap(t)); }
protected void onException(Throwable t) { try { UncaughtExceptionHandler ueh; if ((ueh = uncaughtExceptionHandler) != null) ueh.uncaughtException(this, t); else if ((ueh = defaultUncaughtExceptionHandler) != null) ueh.uncaughtException(this, t); } catch (Exception e) { if (e != t && t != null) t.addSuppressed(e); } throw Exceptions.rethrow(t); }
protected void onException(Throwable t) { if (uncaughtExceptionHandler != null) uncaughtExceptionHandler.uncaughtException(this, t); else if (defaultUncaughtExceptionHandler != null) defaultUncaughtExceptionHandler.uncaughtException(this, t); else Exceptions.rethrow(t); // swallow exception }
/** * 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()); } }
@Override protected void handleLifecycleMessage(LifecycleMessage m) { if (m instanceof ExitMessage) { final ExitMessage exit = (ExitMessage) m; if (Objects.equals(exit.getActor(), actor) && exit.getWatch() == null) throw Exceptions.rethrow(exit.getCause()); } super.handleLifecycleMessage(m); } };