public interface MatsConfig
MatsFactory
, MatsEndpoint
and MatsStage
have some configurable elements, provided by a
config instance, this is the top of that hierarchy.Modifier and Type | Interface and Description |
---|---|
static interface |
MatsConfig.StartStoppable
|
Modifier and Type | Method and Description |
---|---|
<T> T |
getAttribute(java.lang.String key) |
int |
getConcurrency()
Returns the concurrency set up for this factory, or endpoint, or stage.
|
int |
getInteractiveConcurrency()
Returns the interactive concurrency set up for this factory, or endpoint, or stage.
|
boolean |
isConcurrencyDefault() |
boolean |
isInteractiveConcurrencyDefault() |
boolean |
isRunning() |
MatsConfig |
setAttribute(java.lang.String key,
java.lang.Object value)
Sets an attribute for this entity (factory, endpoint, stage) - can e.g.
|
MatsConfig |
setConcurrency(int concurrency)
Changes the default concurrency of the Factory, or of the endpoint (which defaults to the concurrency of the
MatsFactory ), or of the process stage (which defaults to the concurrency of the MatsEndpoint ). |
MatsConfig |
setInteractiveConcurrency(int concurrency)
Like
setConcurrency(int) , but changes the "interactive concurrency" specifically - this is relevant for
the Mats Flows that are initiated with the interactive flag set. |
int getConcurrency()
setConcurrency(int)
before start.
It is the MatsStage
s that eventually will be affected by this number, specifically how many standard and
interactive
StageProcessors is fired up for each Stage. One StageProcessor is
one thread consuming from the stage-specific queue, thus if the concurrency for a Stage is resolved to be 6, then
by default 2 x 6 threads will be consuming from this stage's queue: 6 for normal priority, and 6 for interactive
priority.
If default logic is in effect (i.e. have not been set by setConcurrency(int)
, or that is set to 0), a
MatsStage
will default to its MatsEndpoint
, while an endpoint will default to the
MatsFactory
. The default for the MatsFactory
is 2 x the number returned by
MatsFactory.FactoryConfig.getNumberOfCpus()
, which by default is the number of processors on the server it is running
on, as determined by Runtime.availableProcessors()
(but this default can be changed by setting the System
Property "mats.cpus").setConcurrency(int)
before start.setConcurrency(int)
,
isConcurrencyDefault()
,
getInteractiveConcurrency()
,
setInteractiveConcurrency(int)
MatsConfig setConcurrency(int concurrency)
MatsFactory
), or of the process stage (which defaults to the concurrency of the MatsEndpoint
).
Will only have effect before the MatsStage
is started. Can be reset by stopping, setting, and restarting.
Setting to 0 will invoke default logic.concurrency
- the concurrency for the Factory, or Endpoint, or Stage. If set to 0, default-logic is in effect.getConcurrency()
boolean isConcurrencyDefault()
getConcurrency()
is using default-logic (when the concurrency is
set to 0) (true
), or if it is set specifically (false).getConcurrency()
int getInteractiveConcurrency()
setConcurrency(int)
before start.
If default logic is in effect (i.e. have not been set by setConcurrency(int)
, or that is set to 0), a
MatsStage
will see if the same Stage's normal concurrency is non-default, and if so, use that -
otherwise, it will use the interactive concurrency of its parent Endpoint. The MatsEndpoint
will see if
the same Endpoint's normal concurrency is non-default, and if so, use that - otherwise it will use the
interactive concurrency of its parent Factory. The MatsFactory
will by default use the normal concurrency
of the Factory.
Effectively, a more specific setting for interactive concurrency overrides a less specific. Stage is more
specific than Endpoint, which is more specific than Factory, and in addition interactive is more specific than
normal.setInteractiveConcurrency(int)
before start.setInteractiveConcurrency(int)
,
isInteractiveConcurrencyDefault()
,
getConcurrency()
,
setConcurrency(int)
MatsConfig setInteractiveConcurrency(int concurrency)
setConcurrency(int)
, but changes the "interactive concurrency" specifically - this is relevant for
the Mats Flows that are initiated with the interactive
flag set.concurrency
- the interactive concurrency for the Factory, or Endpoint, or Stage. If set to 0, default-logic is in
effect.getInteractiveConcurrency()
boolean isInteractiveConcurrencyDefault()
getInteractiveConcurrency()
is using default-logic (when the
concurrency is set to 0) (true
), or if it is set specifically (false).getInteractiveConcurrency()
boolean isRunning()
MatsFactory
, it returns true if
any of the endpoints return true (which also implies that if there are no Endpoints registered, it will
return false
). For MatsEndpoint
s, it returns true if any stage is running.MatsConfig setAttribute(java.lang.String key, java.lang.Object value)
null
, the mapping for the specified key is cleared.key
- the key name for this attribute. Not null
.value
- the value for this attribute. If the value is null
, the mapping for the specified key is
cleared.<T> T getAttribute(java.lang.String key)
T
- the type of this attribute, to avoid explicit casting - but you should really know the type, otherwise
request Object
.key
- the key name for this attribute.