Package com.yahoo.concurrent
Class DaemonThreadFactory
- java.lang.Object
-
- com.yahoo.concurrent.DaemonThreadFactory
-
- All Implemented Interfaces:
ThreadFactory
public class DaemonThreadFactory extends Object implements ThreadFactory
A simple thread factory that decoratesExecutors.defaultThreadFactory()
and sets all created threads to be daemon threads.- Author:
- Einar M R Rosenvinge
-
-
Constructor Summary
Constructors Constructor Description DaemonThreadFactory()
Creates a deamon thread factory that creates threads with the default names provided byExecutors.defaultThreadFactory()
.DaemonThreadFactory(String prefix)
Creates a deamon thread factory that creates threads with the default names provided byExecutors.defaultThreadFactory()
prepended by the specified prefix.
-
-
-
Constructor Detail
-
DaemonThreadFactory
public DaemonThreadFactory()
Creates a deamon thread factory that creates threads with the default names provided byExecutors.defaultThreadFactory()
.
-
DaemonThreadFactory
public DaemonThreadFactory(String prefix)
Creates a deamon thread factory that creates threads with the default names provided byExecutors.defaultThreadFactory()
prepended by the specified prefix.- Parameters:
prefix
- the thread name prefix to use
-
-
Method Detail
-
getPrefix
public String getPrefix()
-
newThread
public Thread newThread(Runnable runnable)
- Specified by:
newThread
in interfaceThreadFactory
-
-