Class NamedThreadFactory

java.lang.Object
com.linkedin.alpini.base.concurrency.NamedThreadFactory
All Implemented Interfaces:
ThreadFactory

public class NamedThreadFactory extends Object implements ThreadFactory
ThreadFactory which creates named threads for use in an ExecutorService. Each factory has a pool name and threads in the pool will have the name "poolName-X-thread-Y". If multiple factories are created with the same poolName then each will get its own unique number "X". For example, if two pools were created with the name "workers" then you would see threads like "workers-1-thread-1" and "workers-2-thread-1".
  • Constructor Details

    • NamedThreadFactory

      public NamedThreadFactory(String poolName)
      Construct a new NamedThreadFactory with the given pool name.
      Parameters:
      poolName - the name to be used as part of the prefix for this factory.
    • NamedThreadFactory

      public NamedThreadFactory(ThreadGroup threadGroup, String poolName)
      Construct a new NamedThreadFactory with the given thread group and pool name.
      Parameters:
      threadGroup - the thread group which the new threads belong.
      poolName - the name to be used as part of the prefix for this factory.
    • NamedThreadFactory

      public NamedThreadFactory(ThreadFactory threadFactory, String poolName)
  • Method Details