Class ThrowableCatchingRunnable

  • All Implemented Interfaces:
    Runnable

    public class ThrowableCatchingRunnable
    extends Object
    implements Runnable
    This class catches all the Throwables from the wrapped runnable. This class is useful when the wrapped runnable is submitted to an executor where the UncaughtExceptionHandler is not usable.
    • Constructor Detail

      • ThrowableCatchingRunnable

        public ThrowableCatchingRunnable​(java.util.function.Consumer<Throwable> exceptionHandler,
                                         Runnable runnable)
    • Method Detail

      • run

        public void run()
        Specified by:
        run in interface Runnable