org.apache.commons.lang3.concurrent

## Class BasicThreadFactory.Builder

- java.lang.Object
- - org.apache.commons.lang3.concurrent.BasicThreadFactory.Builder

- All Implemented Interfaces:
    Builder<BasicThreadFactory>
  Enclosing class:
    BasicThreadFactory

      public static class BasicThreadFactory.Builder
      extends Object
      implements Builder<BasicThreadFactory>

  A builder class for creating instances of `BasicThreadFactory`.

  Using this builder class instances of `BasicThreadFactory` can be created and initialized. The class provides methods that correspond to the configuration options supported by `BasicThreadFactory`. Method chaining is supported. Refer to the documentation of `BasicThreadFactory` for a usage example.

  Version:
    $Id: BasicThreadFactory.java 1583482 2014-03-31 22:54:57Z niallp $

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BasicThreadFactory.Builder()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `BasicThreadFactory` | `build()` Creates a new `BasicThreadFactory` with all configuration options that have been specified by calling methods on this builder.
    `BasicThreadFactory.Builder` | `daemon(boolean f)` Sets the daemon flag for the new `BasicThreadFactory`.
    `BasicThreadFactory.Builder` | `namingPattern(String pattern)` Sets the naming pattern to be used by the new `BasicThreadFactory`.
    `BasicThreadFactory.Builder` | `priority(int prio)` Sets the priority for the threads created by the new `BasicThreadFactory`.
    `void` | `reset()` Resets this builder.
    `BasicThreadFactory.Builder` | `uncaughtExceptionHandler(Thread.UncaughtExceptionHandler handler)` Sets the uncaught exception handler for the threads created by the new `BasicThreadFactory`.
    `BasicThreadFactory.Builder` | `wrappedFactory(ThreadFactory factory)` Sets the `ThreadFactory` to be wrapped by the new `BasicThreadFactory`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### BasicThreadFactory.Builder

          public BasicThreadFactory.Builder()

  - ### Method Detail

    - #### wrappedFactory

          public BasicThreadFactory.Builder wrappedFactory(ThreadFactory factory)

      Sets the `ThreadFactory` to be wrapped by the new `BasicThreadFactory`.
      Parameters:
        `factory` - the wrapped `ThreadFactory` (must not be null)
      Returns:
        a reference to this `Builder`
      Throws:
        `NullPointerException` - if the passed in `ThreadFactory` is null

    - #### namingPattern

          public BasicThreadFactory.Builder namingPattern(String pattern)

      Sets the naming pattern to be used by the new `BasicThreadFactory`.
      Parameters:
        `pattern` - the naming pattern (must not be null)
      Returns:
        a reference to this `Builder`
      Throws:
        `NullPointerException` - if the naming pattern is null

    - #### daemon

          public BasicThreadFactory.Builder daemon(boolean f)

      Sets the daemon flag for the new `BasicThreadFactory`. If this flag is set to true the new thread factory will create daemon threads.
      Parameters:
        `f` - the value of the daemon flag
      Returns:
        a reference to this `Builder`

    - #### priority

          public BasicThreadFactory.Builder priority(int prio)

      Sets the priority for the threads created by the new `BasicThreadFactory`.
      Parameters:
        `prio` - the priority
      Returns:
        a reference to this `Builder`

    - #### uncaughtExceptionHandler

          public BasicThreadFactory.Builder uncaughtExceptionHandler(Thread.UncaughtExceptionHandler handler)

      Sets the uncaught exception handler for the threads created by the new `BasicThreadFactory`.
      Parameters:
        `handler` - the `UncaughtExceptionHandler` (must not be null)
      Returns:
        a reference to this `Builder`
      Throws:
        `NullPointerException` - if the exception handler is null

    - #### reset

          public void reset()

      Resets this builder. All configuration options are set to default values. Note: If the `build()` method was called, it is not necessary to call `reset()` explicitly because this is done automatically.

    - #### build

          public BasicThreadFactory build()

      Creates a new `BasicThreadFactory` with all configuration options that have been specified by calling methods on this builder. After creating the factory `reset()` is called.
      Specified by:
        `build` in interface `Builder<BasicThreadFactory>`
      Returns:
        the new `BasicThreadFactory`

Copyright © 2001–2015 The Apache Software Foundation. All rights reserved.