All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.webbitserver.netty.CatchingRunnable Maven / Gradle / Ivy

package org.webbitserver.netty;

public abstract class CatchingRunnable implements Runnable {
    private final Thread.UncaughtExceptionHandler exceptionHandler;

    public CatchingRunnable(Thread.UncaughtExceptionHandler exceptionHandler) {
        this.exceptionHandler = exceptionHandler;
    }

    @Override
    public void run() {
        try {
            go();
        } catch (Throwable t) {
            exceptionHandler.uncaughtException(Thread.currentThread(), t);
        }
    }

    protected abstract void go() throws Throwable;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy