Package io.mats3
Interface MatsStage<R,S,I>
- All Superinterfaces:
MatsConfig.StartStoppable
- All Known Implementing Classes:
JmsMatsStage
A representation of a process stage of a
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.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceProvides for both configuring the stage (before it is started), and introspecting the configuration. -
Method Summary
Modifier and TypeMethodDescriptionvoidstart()Starts this stage, thereby firing up the queue processing using a set of threads, the number decided by theMatsConfig.getConcurrency()for each stage.booleanstop(int gracefulShutdownMillis) Stops this stage.booleanwaitForReceiving(int timeoutMillis) Will wait until at least one processor of the stage has entered its receive-loop.
-
Method Details
-
getStageConfig
MatsStage.StageConfig<R,S, getStageConfig()I> - Returns:
- the
MatsStage.StageConfigfor this stage.
-
getParentEndpoint
MatsEndpoint<R,S> getParentEndpoint()- Returns:
- the parent
MatsEndpoint.
-
start
void start()Starts this stage, thereby firing up the queue processing using a set of threads, the number decided by theMatsConfig.getConcurrency()for each stage. Will generally be invoked implicitly byMatsEndpoint.start(). The only reason for calling this should be if its correspondingstop(int)method has been invoked to stop processing.- Specified by:
startin interfaceMatsConfig.StartStoppable
-
waitForReceiving
boolean waitForReceiving(int timeoutMillis) Will wait until at least one processor of the stage has entered its receive-loop.- Specified by:
waitForReceivingin interfaceMatsConfig.StartStoppable- Parameters:
timeoutMillis- number of milliseconds before giving up the wait, returningfalse. 0 is indefinite wait, negative values are not allowed.- Returns:
trueif the entity started within the timeout,falseif it did not start.
-
stop
boolean stop(int gracefulShutdownMillis) Stops this stage. This may be used to temporarily stop processing of this stage by means of some external monitor/inspecting mechanism (e.g. in cases where it has been showed to produce results that breaks downstream stages or endpoints, or itself produces Dead Letter Queue-entries due to some external problem). It is possible tostart()the stage again.- Specified by:
stopin interfaceMatsConfig.StartStoppable- Parameters:
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.- Returns:
trueif the running thread(s) were dead when returning,falseotherwise.
-