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

com.github.afarion1.command_handler.utils.NamedThreadFactory Maven / Gradle / Ivy

There is a newer version: 0.1.2
Show newest version
package com.github.afarion1.command_handler.utils;

import org.jetbrains.annotations.NotNull;

import java.util.concurrent.ThreadFactory;

public class NamedThreadFactory implements ThreadFactory {

    private final String name;
    private int i = 1;

    public NamedThreadFactory(String threadName) {
        this.name = threadName;
    }

    @Override
    public Thread newThread(@NotNull Runnable r) {
        return new Thread(r, name + " " + i++);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy