Package org.alfresco.util
Class TraceableThreadFactory
- java.lang.Object
-
- org.alfresco.util.TraceableThreadFactory
-
- All Implemented Interfaces:
ThreadFactory
public class TraceableThreadFactory extends Object implements ThreadFactory
A thread factory that spawns threads that are statically visible. Each factory uses a unique thread group. All the groups that have been used can be fetched usinggetActiveThreadGroups()
, allowing iteration of the the threads in the group.- Since:
- 2.1
- Author:
- Derek Hulley
-
-
Constructor Summary
Constructors Constructor Description TraceableThreadFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static List<ThreadGroup>
getActiveThreadGroups()
Get a list of thread groups registered by the factory.String
getNamePrefix()
Thread
newThread(Runnable r)
void
setNamePrefix(String namePrefix)
void
setThreadDaemon(boolean daemon)
void
setThreadPriority(int threadPriority)
-
-
-
Method Detail
-
getActiveThreadGroups
public static List<ThreadGroup> getActiveThreadGroups()
Get a list of thread groups registered by the factory.- Returns:
- Returns a snapshot of thread groups
-
setThreadDaemon
public void setThreadDaemon(boolean daemon)
- Parameters:
daemon
- true if all threads created must be daemon threads
-
setThreadPriority
public void setThreadPriority(int threadPriority)
- Parameters:
threadPriority
- the threads priority from 1 (lowest) to 10 (highest)
-
newThread
public Thread newThread(Runnable r)
- Specified by:
newThread
in interfaceThreadFactory
-
setNamePrefix
public void setNamePrefix(String namePrefix)
-
getNamePrefix
public String getNamePrefix()
-
-