Package org.alfresco.util
Class TraceableThreadFactory
- java.lang.Object
-
- org.alfresco.util.TraceableThreadFactory
-
- All Implemented Interfaces:
java.util.concurrent.ThreadFactory
public class TraceableThreadFactory extends java.lang.Object implements java.util.concurrent.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 java.util.List<java.lang.ThreadGroup>
getActiveThreadGroups()
Get a list of thread groups registered by the factory.java.lang.String
getNamePrefix()
java.lang.Thread
newThread(java.lang.Runnable r)
void
setNamePrefix(java.lang.String namePrefix)
void
setThreadDaemon(boolean daemon)
void
setThreadPriority(int threadPriority)
-
-
-
Method Detail
-
getActiveThreadGroups
public static java.util.List<java.lang.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 java.lang.Thread newThread(java.lang.Runnable r)
- Specified by:
newThread
in interfacejava.util.concurrent.ThreadFactory
-
setNamePrefix
public void setNamePrefix(java.lang.String namePrefix)
-
getNamePrefix
public java.lang.String getNamePrefix()
-
-