
com.swoval.concurrent.ThreadFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of apple-file-events Show documentation
Show all versions of apple-file-events Show documentation
JNI library for apple file system
The newest version!
package com.swoval.concurrent;
import java.util.concurrent.atomic.AtomicInteger;
public class ThreadFactory implements java.util.concurrent.ThreadFactory {
private final ThreadGroup group;
private final String name;
private AtomicInteger counter = new AtomicInteger(0);
public ThreadFactory(String name) {
SecurityManager s = System.getSecurityManager();
group = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup();
this.name = name;
}
@Override
public Thread newThread(Runnable r) {
return new Thread(group, r, name + "-" + counter.incrementAndGet());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy