Class BasicThreadFactory.Builder

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

    public static class BasicThreadFactory.Builder
    extends java.lang.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.

    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • wrappedFactory

        public BasicThreadFactory.Builder wrappedFactory​(java.util.concurrent.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 BasicThreadFactory.Builder
        Throws:
        java.lang.NullPointerException - if the passed in ThreadFactory is null
      • namingPattern

        public BasicThreadFactory.Builder namingPattern​(java.lang.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 BasicThreadFactory.Builder
        Throws:
        java.lang.NullPointerException - if the naming pattern is null
      • uncaughtExceptionHandler

        public BasicThreadFactory.Builder uncaughtExceptionHandler​(java.lang.Thread.UncaughtExceptionHandler handler)
        Sets the uncaught exception handler for the threads created by the new BasicThreadFactory.
        Parameters:
        handler - the Thread.UncaughtExceptionHandler (must not be null)
        Returns:
        a reference to this BasicThreadFactory.Builder
        Throws:
        java.lang.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.