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

com.slack.api.util.thread.DaemonThreadFactory Maven / Gradle / Ivy

There is a newer version: 1.44.1
Show newest version
package com.slack.api.util.thread;

import java.util.concurrent.ThreadFactory;

public class DaemonThreadFactory implements ThreadFactory {
    private final ThreadGroup threadGroup;

    public DaemonThreadFactory(String threadGroupName) {
        this.threadGroup = new ThreadGroup(threadGroupName);
    }

    @Override
    public Thread newThread(Runnable r) {
        Thread t = new Thread(threadGroup, r);
        t.setDaemon(true);
        t.setName(t.getThreadGroup().getName() + "-worker-" + t.getId());
        return t;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy