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

io.github.linmoure.thread.runnable.LabelRunnable Maven / Gradle / Ivy

There is a newer version: 1.0.7
Show newest version
package io.github.linmoure.thread.runnable;

public interface LabelRunnable extends Runnable {

    String generateLabel();

    void bnsRun();

    @Override
    default void run() {
        String currentLabel = this.generateLabel();
        String threadName = Thread.currentThread().getName();
        if (currentLabel != null && !currentLabel.equals(threadName)) {
            Thread.currentThread().setName(currentLabel);
        }
        this.bnsRun();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy