Class ImmutableThreadFactoryProvider

java.lang.Object
org.opendaylight.yangtools.util.concurrent.ThreadFactoryProvider
org.opendaylight.yangtools.util.concurrent.ImmutableThreadFactoryProvider

@Generated("org.immutables.processor.ProxyProcessor") public final class ImmutableThreadFactoryProvider extends ThreadFactoryProvider
Immutable implementation of ThreadFactoryProvider.

Use the builder to create immutable instances: ImmutableThreadFactoryProvider.builder(). Use the static factory method to create immutable instances: ImmutableThreadFactoryProvider.of().

  • Method Details

    • namePrefix

      public String namePrefix()
      Prefix for threads from this factory. For example, "rpc-pool", to create "rpc-pool-1/2/3" named threads. Note that this is a prefix, not a format, so you pass just "rpc-pool" instead of e.g. "rpc-pool-%d".
      Specified by:
      namePrefix in class ThreadFactoryProvider
    • logger

      public Logger logger()
      Logger used to log uncaught exceptions from new threads created via this factory.
      Specified by:
      logger in class ThreadFactoryProvider
    • priority

      public Optional<Integer> priority()
      Priority for new threads from this factory.
      Specified by:
      priority in class ThreadFactoryProvider
    • daemon

      public boolean daemon()
      Daemon or not for new threads created via this factory. NB: Defaults to true.
      Overrides:
      daemon in class ThreadFactoryProvider
    • withNamePrefix

      public final ImmutableThreadFactoryProvider withNamePrefix(String value)
      Copy the current immutable object by setting a value for the namePrefix attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for namePrefix
      Returns:
      A modified copy of the this object
    • withLogger

      public final ImmutableThreadFactoryProvider withLogger(Logger value)
      Copy the current immutable object by setting a value for the logger attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for logger
      Returns:
      A modified copy of the this object
    • withPriority

      public final ImmutableThreadFactoryProvider withPriority(int value)
      Copy the current immutable object by setting a present value for the optional priority attribute.
      Parameters:
      value - The value for priority
      Returns:
      A modified copy of this object
    • withPriority

      public final ImmutableThreadFactoryProvider withPriority(Optional<Integer> optional)
      Copy the current immutable object by setting an optional value for the priority attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for priority
      Returns:
      A modified copy of this object
    • withDaemon

      public final ImmutableThreadFactoryProvider withDaemon(boolean value)
      Copy the current immutable object by setting a value for the daemon attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for daemon
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of ImmutableThreadFactoryProvider that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: namePrefix, logger, priority, daemon.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value ThreadFactoryProvider with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • of

      public static ImmutableThreadFactoryProvider of(String namePrefix, Logger logger, Optional<Integer> priority)
      Construct a new immutable ThreadFactoryProvider instance.
      Parameters:
      namePrefix - The value for the namePrefix attribute
      logger - The value for the logger attribute
      priority - The value for the priority attribute
      Returns:
      An immutable ThreadFactoryProvider instance
    • copyOf

      public static ImmutableThreadFactoryProvider copyOf(ThreadFactoryProvider instance)
      Creates an immutable copy of a ThreadFactoryProvider value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable ThreadFactoryProvider instance
    • builder

      Creates a builder for ImmutableThreadFactoryProvider.
       ImmutableThreadFactoryProvider.builder()
          .namePrefix(String) // required namePrefix
          .logger(org.slf4j.Logger) // required logger
          .priority(Integer) // optional priority
          .daemon(boolean) // optional daemon
          .build();
       
      Returns:
      A new ImmutableThreadFactoryProvider builder