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

org.webswing.toolkit.util.DeamonThreadFactory Maven / Gradle / Ivy

There is a newer version: 20.2.4
Show newest version
package org.webswing.toolkit.util;

import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;

public class DeamonThreadFactory implements ThreadFactory {

	private final String name;

	private DeamonThreadFactory(String name) {
		this.name = name;
	}

	public static ThreadFactory getInstance(String name) {
		return new DeamonThreadFactory(name);
	}

	@Override
	public Thread newThread(Runnable r) {
		Thread t = Executors.defaultThreadFactory().newThread(r);
        t.setDaemon(true);
        t.setName(name);
        return t;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy