Class NamedThreadFactory

  • All Implemented Interfaces:
    ThreadFactory

    public class NamedThreadFactory
    extends Object
    implements ThreadFactory
    A Thread factory that creates threads whose names begin with a specified prefix. If the specified prefix is foo, the threads created by this factory will have names that look like fooX where 'X' is a monotonically increasing number used to name each thread created by this factory uniquely.

    The factory delegates the thread creation to Executors.defaultThreadFactory(). After the thread has been created by the delegated factory, this class simply resets their name to the desired value.

    Since:
    2.0.0
    Version:
    $Id: NamedThreadFactory.java 16154 2012-07-14 16:34:05Z colin $
    Author:
    anshul@marketcetera.com
    • Constructor Detail

      • NamedThreadFactory

        public NamedThreadFactory​(String inNamePrefix)
        Creates an instance that will create threads whose names begin with the specified prefix.
        Parameters:
        inNamePrefix - the prefix to use for naming every thread created by this factory. Cannot be null.