public static final class EConfigure.DispatcherBuilder extends Object
EConfigure.Dispatcher configuration
instance based on the parameters set via the builder's
API. The minimally allowed configuration is the Dispatcher
name and Dispatcher type if that type is either
EConfigure.DispatcherType.SWING or
EConfigure.DispatcherType.JAVAFX. For a
EConfigure.DispatcherType.EBUS Dispatcher type, then the
thread type must be provided. If this Dispatcher is
not marked as the default, then the classes
assigned to this Dispatcher must be provided.
The remaining properties are set to the following defaults:
EConfigure.DEFAULT_SPIN_LIMIT.
EConfigure.DEFAULT_PARK_TIME.
Thread.NORM_PRIORITY.
EConfigure.DEFAULT_QUANTUM.
EConfigure.DEFAULT_NUMBER_THREADS.
false.
| Modifier and Type | Method and Description |
|---|---|
EConfigure.Dispatcher |
build()
Returns the eBus Dispatcher configuration built from
the previously set parameters.
|
Class<?>[] |
classes()
Returns the array of classes assigned to this
Dispatcher.
|
EConfigure.DispatcherBuilder |
classes(Class<?>[] classes)
Lists the classes assigned to the dispatcher.
|
EConfigure.DispatcherType |
dispatcherType()
Returns the Dispatcher type.
|
EConfigure.DispatcherBuilder |
dispatcherType(EConfigure.DispatcherType type)
Sets the dispatcher type.
|
boolean |
isDefault()
Returns
true if the Dispatcher is configured
to be the default Dispatcher. |
EConfigure.DispatcherBuilder |
isDefault(boolean flag)
If
flag is true, then marks the
dispatcher as the default dispatcher. |
String |
name()
Returns the Dispatcher name.
|
EConfigure.DispatcherBuilder |
name(String name)
Sets the dispatcher name.
|
int |
numberThreads()
Returns the number of Dispatcher threads.
|
EConfigure.DispatcherBuilder |
numberThreads(int numThreads)
Sets the number of threads used by the run queue.
|
long |
parkTime()
Returns the nanosecond park time.
|
EConfigure.DispatcherBuilder |
parkTime(long time)
Sets the
ThreadType.SPINPARK nanosecond park
time. |
int |
priority()
Returns the Dispatcher thread priority.
|
EConfigure.DispatcherBuilder |
priority(int priority)
Sets the run queue thread priority.
|
long |
quantum()
Returns the eBus client run quantum.
|
EConfigure.DispatcherBuilder |
quantum(long quantum)
Sets the run quantum assigned to each eBus client.
|
long |
spinLimit()
Returns the spin limit.
|
EConfigure.DispatcherBuilder |
spinLimit(long limit)
Sets the
ThreadType.SPINPARK or
ThreadType.SPINYIELD spin limit. |
ThreadType |
threadType()
Returns the Dispatcher thread type.
|
EConfigure.DispatcherBuilder |
threadType(ThreadType type)
Sets the run queue thread type.
|
public String name()
null if
the name is not set.public EConfigure.DispatcherType dispatcherType()
null if
the Dispatcher type is not set.public ThreadType threadType()
null if not yet set.public long spinLimit()
EConfigure.DispatcherType.EBUS and
the thread type is either ThreadType.SPINPARK
or ThreadType.SPINYIELD.public long parkTime()
EConfigure.DispatcherType.EBUS and the thread type is
ThreadType.SPINPARK.public int priority()
public long quantum()
public int numberThreads()
public boolean isDefault()
true if the Dispatcher is configured
to be the default Dispatcher.true if default Dispatcher.public Class<?>[] classes()
null. Returned
array is a copy of this builder's class array.public EConfigure.DispatcherBuilder name(String name)
name - dispatcher name.this dispatcher builder.NullPointerException - if name is null.IllegalArgumentException - if name is empty.public EConfigure.DispatcherBuilder dispatcherType(EConfigure.DispatcherType type)
type - dispatcher type.this dispatcher builder.NullPointerException - if type is null.public EConfigure.DispatcherBuilder threadType(ThreadType type)
EConfigure.DispatcherType.SWING or
EConfigure.DispatcherType.JAVAFX.type - thread type.this dispatcher builder.NullPointerException - if type is null.public EConfigure.DispatcherBuilder spinLimit(long limit)
ThreadType.SPINPARK or
ThreadType.SPINYIELD spin limit. This setting
is ignored for any other run queue thread type.limit - spin limit.this dispatcher builder.IllegalArgumentException - if limit < zero.public EConfigure.DispatcherBuilder parkTime(long time)
ThreadType.SPINPARK nanosecond park
time. This setting is ignored for any other run queue
thread type.time - nanosecond park time.this dispatcher builder.IllegalArgumentException - if time < zero.public EConfigure.DispatcherBuilder priority(int priority)
Thread.MIN_PRIORITY and ≤
Thread.MAX_PRIORITY. This setting is ignored
if the Dispatcher type is EConfigure.DispatcherType.SWING
or EConfigure.DispatcherType.JAVAFX.priority - assigned thread priority for run queue
threads.this dispatcher builder.IllegalArgumentException - if priority < zero or >
Thread.MAX_PRIORITY.public EConfigure.DispatcherBuilder quantum(long quantum)
quantum - run quantum.this dispatcher builder.IllegalArgumentException - if quantum < zero.public EConfigure.DispatcherBuilder numberThreads(int numThreads)
EConfigure.DispatcherType.SWING or
EConfigure.DispatcherType.JAVAFX.numThreads - number of run queue threads.this dispatcher builder.IllegalArgumentException - if numThreads < zero.public EConfigure.DispatcherBuilder isDefault(boolean flag)
flag is true, then marks the
dispatcher as the default dispatcher.flag - true marks the dispatcher as the
default.this dispatcher builder.public EConfigure.DispatcherBuilder classes(Class<?>[] classes)
classes may be null or empty. If the
dispatcher is not default, then
classes must be defined as a non-null,
non-empty array.
This parameter is checked when the dispatcher is
built since the validation depends on
whether the dispatcher is default or not.
classes - eBus client classes assigned to the
Dispatcher.this dispatcher builder.public EConfigure.Dispatcher build()
NullPointerException - if either the Dispatcher name, Dispatcher type, or run
queue thread type are not set.IllegalArgumentException - if the Dispatcher is not marked as default and no
classes were provided.Copyright © 2019. All rights reserved.