Class NamedThreadFactory

  • All Implemented Interfaces:
    java.util.concurrent.ThreadFactory

    public class NamedThreadFactory
    extends java.lang.Object
    implements java.util.concurrent.ThreadFactory
    A default ThreadFactory implementation that accepts the name prefix of the created threads as a constructor argument. Otherwise, this factory yields the same semantics as the thread factory returned by Executors.defaultThreadFactory().
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Thread newThread​(java.lang.Runnable r)
      Creates a new Thread
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NamedThreadFactory

        public NamedThreadFactory​(java.lang.String threadNamePrefix)
        Creates a new NamedThreadFactory instance
        Parameters:
        threadNamePrefix - the name prefix assigned to each thread created.
    • Method Detail

      • newThread

        public java.lang.Thread newThread​(java.lang.Runnable r)
        Creates a new Thread
        Specified by:
        newThread in interface java.util.concurrent.ThreadFactory
        See Also:
        ThreadFactory.newThread(java.lang.Runnable)