I also have one of these. +1
Chas > On Dec 21, 2017, at 7:34 AM, Roger Whitcomb <roger.whitc...@actian.com> wrote: > > I have a class almost identical to this in my project, so +1 to this idea. > > ~Roger Whitcomb > > -----Original Message----- > From: Gary Gregory [mailto:garydgreg...@gmail.com] > Sent: Tuesday, December 19, 2017 8:27 AM > To: Commons Developers List <dev@commons.apache.org> > Subject: [lang] Add a DaemonThreadFactory > > I keep on copying this from project to project and it seems fitting for > Commons Lang: > > import java.util.concurrent.ThreadFactory; > import java.util.concurrent.atomic.AtomicLong; > > public final class DaemonThreadFactory implements ThreadFactory { > > private final static AtomicLong COUNT = new AtomicLong(1); > > private final String name; > > public DaemonThreadFactory(final String name) { > super(); > this.name = name; > } > > @Override > public Thread newThread(final Runnable r) { > final Thread thread = new Thread(r, name + " " + > COUNT.getAndIncrement()); > thread.setDaemon(true); > return thread; > } > > } > > Thoughts? > > Gary > B‹KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKCB•È[œÝXœØÜšX™KK[XZ[ˆ]‹][œÝXœØÜšX™PÛÛ[[ۜ˘\XÚK›Ü™ÃB‘›ÜˆY][Û˜[ÛÛ[X[™ËK[XZ[ˆ]‹Z[ÛÛ[[ۜ˘\XÚK›Ü™ÃB --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org