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

org.qbicc.machine.tool.process.CloseableThread Maven / Gradle / Ivy

There is a newer version: 0.77.0
Show newest version
package org.qbicc.machine.tool.process;

import java.io.IOException;

import io.smallrye.common.function.ExceptionRunnable;

final class CloseableThread extends Thread {
    private final ExceptionRunnable runnable;

    Throwable problem;

    CloseableThread(final String name) {
        this(name, () -> {});
    }

    CloseableThread(final String name, final ExceptionRunnable runnable) {
        super(name);
        this.runnable = runnable;
    }

    public final void run() {
        try {
            runWithException();
        } catch (Throwable t) {
            problem = t;
        }
    }

    void runWithException() throws IOException {
        runnable.run();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy