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

org.embulk.exec.SetCurrentThreadName Maven / Gradle / Ivy

package org.embulk.exec;

import static java.util.Locale.ENGLISH;

public class SetCurrentThreadName implements AutoCloseable {
    private final String original;

    public SetCurrentThreadName(String name) {
        this.original = Thread.currentThread().getName();
        Thread thread = Thread.currentThread();
        thread.setName(String.format(ENGLISH, "%04d:", thread.getId()) + name);
    }

    @Override
    public void close() {
        Thread.currentThread().setName(original);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy