public static final class ENetConfigure.SelectorInfoBuilder extends Object
ENetConfigure.SelectorInfo instance based on the
parameters set via the builder's API. The minimally
allowed configuration is based on the selector's thread
type. In all cases a unique selector name and type must be
provided. The selector parameters are:
Required: Yes.
thread type.
Required: Yes.
true,
then this is the default selector for all channels
which do not specify a selector.
Required: No.
Default Setting: false.
Thread.MIN_PRIORITY,
Thread.NORM_PRIORITY, or
Thread.MAX_PRIORITY.
Required: No.
Default Setting:
ENetConfigure.DEFAULT_PRIORITY.
Required: No.
Default Setting:
ENetConfigure.DEFAULT_SPIN_LIMIT.
Required: No.
Default Setting:
ENetConfigure.DEFAULT_PARK_TIME.
SelectorInfo final ENetConfigure.SelectorInfoBuilder builder = ENetConfigure.selectorBuilder();
final ENetConfigure.SelectorInfo selectorInfo = builder.name("app_selector")
.type(ThreadType.SPINPARK)
.isDefault(true)
.spinLimit(2_000_000L)
.parkTime(500L)
.build();| Modifier and Type | Method and Description |
|---|---|
ENetConfigure.SelectorInfo |
build()
Returns the
ENetConfigure.SelectorInfo instance created from
the configuration settings. |
boolean |
isDefault()
Returns
true if this user-defined selector
thread is the default selector. |
ENetConfigure.SelectorInfoBuilder |
isDefault(boolean flag)
Sets the selector flag marking whether this is the
default selector or not.
|
String |
name()
Returns the unique selector thread name.
|
ENetConfigure.SelectorInfoBuilder |
name(String name)
Sets the selector name to the given value.
|
long |
parkTime()
Returns the spin+park nanosecond park time.
|
ENetConfigure.SelectorInfoBuilder |
parkTime(long time)
Sets a spin+park selector thread's park time.
|
int |
priority()
Returns the selector thread priority.
|
ENetConfigure.SelectorInfoBuilder |
priority(int priority)
Sets the selector thread priority to the given value.
|
long |
spinLimit()
Returns a spin+park
ESelector spin limit. |
ENetConfigure.SelectorInfoBuilder |
spinLimit(long limit)
Sets a spinning selector thread's spin limit.
|
ThreadType |
type()
Returns the
ESelector type. |
ENetConfigure.SelectorInfoBuilder |
type(ThreadType type)
Sets the selector thread type to the given value.
|
public String name()
public ThreadType type()
ESelector type.public boolean isDefault()
true if this user-defined selector
thread is the default selector.true if the default selector thread.public int priority()
public long spinLimit()
ESelector spin limit.public long parkTime()
public ENetConfigure.SelectorInfoBuilder name(String name)
name - selector name.this SelectorInfoBuilder.com.typesafe.config.ConfigException - if name is either null or an empty
string.public ENetConfigure.SelectorInfoBuilder type(ThreadType type)
type - selector thread type.this SelectorInfoBuilder.com.typesafe.config.ConfigException - if type is null.public ENetConfigure.SelectorInfoBuilder isDefault(boolean flag)
flag - true if this is the default
selector thread.this SelectorInfoBuilder.public ENetConfigure.SelectorInfoBuilder priority(int priority)
priority - thread priority.this SelectorInfoBuilder.com.typesafe.config.ConfigException - if priority is < Thread.MIN_PRIORITY
or > Thread.MAX_PRIORITY.public ENetConfigure.SelectorInfoBuilder spinLimit(long limit)
limit - number of time the thread may spin on
select before parking.this SelectorInfoBuilder.com.typesafe.config.ConfigException - if limit is ≤ zero.public ENetConfigure.SelectorInfoBuilder parkTime(long time)
time - nanosecond thread park time.this SelectorInfoBuilder.com.typesafe.config.ConfigException - if time is ≤ zero.public ENetConfigure.SelectorInfo build()
ENetConfigure.SelectorInfo instance created from
the configuration settings.SelectorInfo instance.com.typesafe.config.ConfigException - if SelectorInfo configuration is invalid.Copyright © 2019. All rights reserved.