Class ImmutableThreadFactoryProvider
- java.lang.Object
-
- org.opendaylight.infrautils.utils.concurrent.ThreadFactoryProvider
-
- org.opendaylight.infrautils.utils.concurrent.ImmutableThreadFactoryProvider
-
@Generated("org.immutables.processor.ProxyProcessor") public final class ImmutableThreadFactoryProvider extends ThreadFactoryProvider
Immutable implementation ofThreadFactoryProvider.Use the builder to create immutable instances:
ImmutableThreadFactoryProvider.builder(). Use the static factory method to create immutable instances:ImmutableThreadFactoryProvider.of().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableThreadFactoryProvider.BuilderBuilds instances of typeImmutableThreadFactoryProvider.static interfaceImmutableThreadFactoryProvider.BuildFinalstatic interfaceImmutableThreadFactoryProvider.LoggerBuildStagestatic interfaceImmutableThreadFactoryProvider.NamePrefixBuildStage
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImmutableThreadFactoryProvider.NamePrefixBuildStagebuilder()Creates a builder forImmutableThreadFactoryProvider.static ImmutableThreadFactoryProvidercopyOf(ThreadFactoryProvider instance)Creates an immutable copy of aThreadFactoryProvidervalue.booleandaemon()Daemon or not for new threads created via this factory.booleanequals(Object another)This instance is equal to all instances ofImmutableThreadFactoryProviderthat have equal attribute values.inthashCode()Computes a hash code from attributes:namePrefix,logger,priority,daemon.org.slf4j.Loggerlogger()Logger used to log uncaught exceptions from new threads created via this factory.StringnamePrefix()Prefix for threads from this factory.static ImmutableThreadFactoryProviderof(String namePrefix, org.slf4j.Logger logger, Optional<Integer> priority)Construct a new immutableThreadFactoryProviderinstance.Optional<Integer>priority()Priority for new threads from this factory.StringtoString()Prints the immutable valueThreadFactoryProviderwith attribute values.ImmutableThreadFactoryProviderwithDaemon(boolean value)Copy the current immutable object by setting a value for thedaemonattribute.ImmutableThreadFactoryProviderwithLogger(org.slf4j.Logger value)Copy the current immutable object by setting a value for theloggerattribute.ImmutableThreadFactoryProviderwithNamePrefix(String value)Copy the current immutable object by setting a value for thenamePrefixattribute.ImmutableThreadFactoryProviderwithPriority(int value)Copy the current immutable object by setting a present value for the optionalpriorityattribute.ImmutableThreadFactoryProviderwithPriority(Optional<Integer> optional)Copy the current immutable object by setting an optional value for thepriorityattribute.-
Methods inherited from class org.opendaylight.infrautils.utils.concurrent.ThreadFactoryProvider
get
-
-
-
-
Method Detail
-
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:
namePrefixin classThreadFactoryProvider
-
logger
public org.slf4j.Logger logger()
Logger used to log uncaught exceptions from new threads created via this factory.- Specified by:
loggerin classThreadFactoryProvider
-
priority
public Optional<Integer> priority()
Priority for new threads from this factory.- Specified by:
priorityin classThreadFactoryProvider
-
daemon
public boolean daemon()
Daemon or not for new threads created via this factory. NB: Defaults to true.- Overrides:
daemonin classThreadFactoryProvider
-
withNamePrefix
public final ImmutableThreadFactoryProvider withNamePrefix(String value)
Copy the current immutable object by setting a value for thenamePrefixattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for namePrefix- Returns:
- A modified copy of the
thisobject
-
withLogger
public final ImmutableThreadFactoryProvider withLogger(org.slf4j.Logger value)
Copy the current immutable object by setting a value for theloggerattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for logger- Returns:
- A modified copy of the
thisobject
-
withPriority
public final ImmutableThreadFactoryProvider withPriority(int value)
Copy the current immutable object by setting a present value for the optionalpriorityattribute.- Parameters:
value- The value for priority- Returns:
- A modified copy of
thisobject
-
withPriority
public final ImmutableThreadFactoryProvider withPriority(Optional<Integer> optional)
Copy the current immutable object by setting an optional value for thepriorityattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for priority- Returns:
- A modified copy of
thisobject
-
withDaemon
public final ImmutableThreadFactoryProvider withDaemon(boolean value)
Copy the current immutable object by setting a value for thedaemonattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for daemon- Returns:
- A modified copy of the
thisobject
-
equals
public boolean equals(Object another)
This instance is equal to all instances ofImmutableThreadFactoryProviderthat have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:namePrefix,logger,priority,daemon.
-
toString
public String toString()
Prints the immutable valueThreadFactoryProviderwith attribute values.
-
of
public static ImmutableThreadFactoryProvider of(String namePrefix, org.slf4j.Logger logger, Optional<Integer> priority)
Construct a new immutableThreadFactoryProviderinstance.- Parameters:
namePrefix- The value for thenamePrefixattributelogger- The value for theloggerattributepriority- The value for thepriorityattribute- Returns:
- An immutable ThreadFactoryProvider instance
-
copyOf
public static ImmutableThreadFactoryProvider copyOf(ThreadFactoryProvider instance)
Creates an immutable copy of aThreadFactoryProvidervalue. 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
public static ImmutableThreadFactoryProvider.NamePrefixBuildStage builder()
Creates a builder forImmutableThreadFactoryProvider.ImmutableThreadFactoryProvider.builder() .namePrefix(String) // requirednamePrefix.logger(org.slf4j.Logger) // requiredlogger.priority(Integer) // optionalpriority.daemon(boolean) // optionaldaemon.build();- Returns:
- A new ImmutableThreadFactoryProvider builder
-
-