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

      • TraceableThreadFactory

        public TraceableThreadFactory()
    • 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 interface java.util.concurrent.ThreadFactory
      • setNamePrefix

        public void setNamePrefix​(java.lang.String namePrefix)
      • getNamePrefix

        public java.lang.String getNamePrefix()