public interface MatsStage<R,S,I> extends MatsConfig.StartStoppable
MatsEndpoint
. Either constructed implicitly (for single-stage
endpoints, and terminators), or by invoking the MatsEndpoint.stage(...)
-methods on multi-stage
endpoints.
Note: It should be possible to use instances of MatsStage
as keys in a HashMap
, i.e. their
equals and hashCode should remain stable throughout the life of the MatsFactory - and similar instances but with
different MatsFactory are not equals. Depending on the implementation, instance equality may be sufficient.Modifier and Type | Interface and Description |
---|---|
static interface |
MatsStage.StageConfig<R,S,I>
Provides for both configuring the stage (before it is started), and introspecting the configuration.
|
Modifier and Type | Method and Description |
---|---|
MatsEndpoint<R,S> |
getParentEndpoint() |
MatsStage.StageConfig<R,S,I> |
getStageConfig() |
void |
start()
Starts this stage, thereby firing up the queue processing using a set of threads, the number decided by the
MatsConfig.getConcurrency() for each stage. |
boolean |
stop(int gracefulShutdownMillis)
Stops this stage.
|
boolean |
waitForReceiving(int timeoutMillis)
Will wait until at least one processor of the stage has entered its receive-loop.
|
MatsStage.StageConfig<R,S,I> getStageConfig()
MatsStage.StageConfig
for this stage.MatsEndpoint<R,S> getParentEndpoint()
MatsEndpoint
.void start()
MatsConfig.getConcurrency()
for each stage.
Will generally be invoked implicitly by MatsEndpoint.start()
. The only reason for calling this should be
if its corresponding stop(int)
method has been invoked to stop processing.start
in interface MatsConfig.StartStoppable
boolean waitForReceiving(int timeoutMillis)
waitForReceiving
in interface MatsConfig.StartStoppable
timeoutMillis
- number of milliseconds before giving up the wait, returning false
. 0 is indefinite
wait, negative values are not allowed.true
if the entity started within the timeout, false
if it did not start.boolean stop(int gracefulShutdownMillis)
start()
the stage again.stop
in interface MatsConfig.StartStoppable
gracefulShutdownMillis
- number of milliseconds to let the stage processors wait after having asked for them to shut down,
and interrupting them if they have not shut down yet.true
if the running thread(s) were dead when returning, false
otherwise.