com.notuvy.thread
Class NamedThreadFactory
java.lang.Object
com.notuvy.thread.NamedThreadFactory
- All Implemented Interfaces:
- ThreadFactory
public class NamedThreadFactory
- extends Object
- implements ThreadFactory
A ThreadFactory that sets an explicit name for the Thread and also defaults it
to be a daemon and sets a simple uncaught exception handler.
It also keeps track of all produced threads, so it can check if the current thread
originated from this factory.
- Author:
- murali
Field Summary |
protected static org.apache.log4j.Logger |
LOG
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LOG
protected static final org.apache.log4j.Logger LOG
NamedThreadFactory
public NamedThreadFactory(String pName,
boolean pDaemon,
Thread.UncaughtExceptionHandler pHandler)
NamedThreadFactory
public NamedThreadFactory(String pName,
boolean pDaemon)
NamedThreadFactory
public NamedThreadFactory(String pName)
getName
public String getName()
originatedCurrent
public boolean originatedCurrent()
- Determine whether the current thread originated from this factory.
- Returns:
- a boolean flag indicating that this factory originated the current thread.
newThread
public Thread newThread(Runnable pRunnable)
- Specified by:
newThread
in interface ThreadFactory
Copyright © 2013. All Rights Reserved.