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 using getActiveThreadGroups(), allowing iteration of the the threads in the group.
Since:
2.1
Author:
Derek Hulley
  • Constructor Details

    • TraceableThreadFactory

      public TraceableThreadFactory()
  • Method Details

    • 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 interface ThreadFactory
    • setNamePrefix

      public void setNamePrefix(String namePrefix)
    • getNamePrefix

      public String getNamePrefix()