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 class
ImmutableThreadFactoryProvider.Builder
Builds instances of typeImmutableThreadFactoryProvider
.static interface
ImmutableThreadFactoryProvider.BuildFinal
static interface
ImmutableThreadFactoryProvider.LoggerBuildStage
static interface
ImmutableThreadFactoryProvider.NamePrefixBuildStage
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImmutableThreadFactoryProvider.NamePrefixBuildStage
builder()
Creates a builder forImmutableThreadFactoryProvider
.static ImmutableThreadFactoryProvider
copyOf(ThreadFactoryProvider instance)
Creates an immutable copy of aThreadFactoryProvider
value.boolean
daemon()
Daemon or not for new threads created via this factory.boolean
equals(Object another)
This instance is equal to all instances ofImmutableThreadFactoryProvider
that have equal attribute values.int
hashCode()
Computes a hash code from attributes:namePrefix
,logger
,priority
,daemon
.org.slf4j.Logger
logger()
Logger used to log uncaught exceptions from new threads created via this factory.String
namePrefix()
Prefix for threads from this factory.static ImmutableThreadFactoryProvider
of(String namePrefix, org.slf4j.Logger logger, Optional<Integer> priority)
Construct a new immutableThreadFactoryProvider
instance.Optional<Integer>
priority()
Priority for new threads from this factory.String
toString()
Prints the immutable valueThreadFactoryProvider
with attribute values.ImmutableThreadFactoryProvider
withDaemon(boolean value)
Copy the current immutable object by setting a value for thedaemon
attribute.ImmutableThreadFactoryProvider
withLogger(org.slf4j.Logger value)
Copy the current immutable object by setting a value for thelogger
attribute.ImmutableThreadFactoryProvider
withNamePrefix(String value)
Copy the current immutable object by setting a value for thenamePrefix
attribute.ImmutableThreadFactoryProvider
withPriority(int value)
Copy the current immutable object by setting a present value for the optionalpriority
attribute.ImmutableThreadFactoryProvider
withPriority(Optional<Integer> optional)
Copy the current immutable object by setting an optional value for thepriority
attribute.-
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:
namePrefix
in classThreadFactoryProvider
-
logger
public org.slf4j.Logger logger()
Logger used to log uncaught exceptions from new threads created via this factory.- Specified by:
logger
in classThreadFactoryProvider
-
priority
public Optional<Integer> priority()
Priority for new threads from this factory.- Specified by:
priority
in classThreadFactoryProvider
-
daemon
public boolean daemon()
Daemon or not for new threads created via this factory. NB: Defaults to true.- Overrides:
daemon
in classThreadFactoryProvider
-
withNamePrefix
public final ImmutableThreadFactoryProvider withNamePrefix(String value)
Copy the current immutable object by setting a value for thenamePrefix
attribute. 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
this
object
-
withLogger
public final ImmutableThreadFactoryProvider withLogger(org.slf4j.Logger value)
Copy the current immutable object by setting a value for thelogger
attribute. 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
this
object
-
withPriority
public final ImmutableThreadFactoryProvider withPriority(int value)
Copy the current immutable object by setting a present value for the optionalpriority
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 thepriority
attribute. 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
this
object
-
withDaemon
public final ImmutableThreadFactoryProvider withDaemon(boolean value)
Copy the current immutable object by setting a value for thedaemon
attribute. 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
this
object
-
equals
public boolean equals(Object another)
This instance is equal to all instances ofImmutableThreadFactoryProvider
that 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 valueThreadFactoryProvider
with attribute values.
-
of
public static ImmutableThreadFactoryProvider of(String namePrefix, org.slf4j.Logger logger, Optional<Integer> priority)
Construct a new immutableThreadFactoryProvider
instance.- Parameters:
namePrefix
- The value for thenamePrefix
attributelogger
- The value for thelogger
attributepriority
- The value for thepriority
attribute- Returns:
- An immutable ThreadFactoryProvider instance
-
copyOf
public static ImmutableThreadFactoryProvider copyOf(ThreadFactoryProvider instance)
Creates an immutable copy of aThreadFactoryProvider
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
public static ImmutableThreadFactoryProvider.NamePrefixBuildStage builder()
Creates a builder forImmutableThreadFactoryProvider
.ImmutableThreadFactoryProvider.builder() .namePrefix(String) // required
namePrefix
.logger(org.slf4j.Logger) // requiredlogger
.priority(Integer) // optionalpriority
.daemon(boolean) // optionaldaemon
.build();- Returns:
- A new ImmutableThreadFactoryProvider builder
-
-