commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chas Honton <c...@honton.org>
Subject Re: [lang] Add a DaemonThreadFactory
Date Thu, 21 Dec 2017 15:38:40 GMT
I also have one of these. 

+1

Chas

> On Dec 21, 2017, at 7:34 AM, Roger Whitcomb <Roger.Whitcomb@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:garydgregory@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-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message