Class ThreadFactoryBuilder

java.lang.Object
jodd.util.ThreadFactoryBuilder

public class ThreadFactoryBuilder extends Object
Fluent ThreadFactory builder.
  • Field Details

  • Constructor Details

    • ThreadFactoryBuilder

      public ThreadFactoryBuilder()
  • Method Details

    • create

      public static ThreadFactoryBuilder create()
      Returns new ThreadFactory builder.
    • withNameFormat

      public ThreadFactoryBuilder withNameFormat(String nameFormat)
      Sets the printf-compatible naming format for threads. Use %d to replace it with the thread number.
    • withDaemon

      public ThreadFactoryBuilder withDaemon(boolean daemon)
      Sets if new threads will be daemon.
    • withPriority

      public ThreadFactoryBuilder withPriority(int priority)
      Sets the threads priority.
    • withUncaughtExceptionHandler

      public ThreadFactoryBuilder withUncaughtExceptionHandler(Thread.UncaughtExceptionHandler uncaughtExceptionHandler)
      Sets the UncaughtExceptionHandler for new threads created.
    • withBackingThreadFactory

      public ThreadFactoryBuilder withBackingThreadFactory(ThreadFactory backingThreadFactory)
      Sets the backing ThreadFactory for new threads. Threads will be created by invoking newThread(Runnable on this backing factory.
    • get

      public ThreadFactory get()
      Returns a new thread factory using the options supplied during the building process. After building, it is still possible to change the options used to build the ThreadFactory and/or build again.
    • get

      private static ThreadFactory get(ThreadFactoryBuilder builder)