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

shz.core.thread.TFConfig Maven / Gradle / Ivy

There is a newer version: 2024.0.2
Show newest version
package shz.core.thread;

import shz.core.NullHelp;

public final class TFConfig {
    enum TFType {
        CUSTOM, DEFAULT
    }

    final TFType type;
    final String threadName;
    boolean daemon;
    int priority = Thread.NORM_PRIORITY;
    ClassLoader cl;
    Thread.UncaughtExceptionHandler eh;

    private TFConfig(TFType type, String threadName) {
        NullHelp.requireNonBlank(threadName);
        this.type = type;
        this.threadName = threadName;
    }

    public static TFConfig custom(String threadName) {
        return new TFConfig(TFType.CUSTOM, threadName);
    }

    public static TFConfig of(String threadName) {
        return new TFConfig(TFType.DEFAULT, threadName);
    }

    public TFConfig daemon(boolean daemon) {
        this.daemon = daemon;
        return this;
    }

    public TFConfig priority(int priority) {
        this.priority = priority;
        return this;
    }

    public TFConfig cl(ClassLoader cl) {
        this.cl = cl;
        return this;
    }

    public TFConfig eh(Thread.UncaughtExceptionHandler eh) {
        this.eh = eh;
        return this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy