Package org.apache.pekko.stream.stage
Class TimerGraphStageLogic
java.lang.Object
org.apache.pekko.stream.stage.GraphStageLogic
org.apache.pekko.stream.stage.TimerGraphStageLogic
- Direct Known Subclasses:
TimerGraphStageLogicWithLogging
Provides timer related facilities to a
GraphStageLogic.
To be thread safe the methods of this class must only be called from either the constructor of the graph operator during
materialization or one of the methods invoked by the graph operator machinery, such as onPush and onPull.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.pekko.stream.stage.GraphStageLogic
GraphStageLogic.ConditionalTerminateInput, GraphStageLogic.ConditionalTerminateOutput, GraphStageLogic.EagerTerminateInput$, GraphStageLogic.EagerTerminateOutput$, GraphStageLogic.IgnoreTerminateInput$, GraphStageLogic.IgnoreTerminateOutput$, GraphStageLogic.StageActor, GraphStageLogic.StageActorRef$, GraphStageLogic.StageActorRefNotInitializedException, GraphStageLogic.StageActorRefNotInitializedException$, GraphStageLogic.SubSinkInlet<T>, GraphStageLogic.SubSourceOutlet<T>, GraphStageLogic.TotallyIgnorantInput$ -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidINTERNAL APIprotected final voidcancelTimer(Object timerKey) Cancel timer, ensuring that theonTimer(java.lang.Object)is not subsequently called.protected final booleanisTimerActive(Object timerKey) Inquire whether the timer is still active.protected voidWill be called when the scheduled timer is triggered.protected final voidscheduleAtFixedRate(Object timerKey, Duration initialDelay, Duration interval) Schedule timer to callonTimer(java.lang.Object)periodically with the givenintervalafter the specified initial delay.protected final voidscheduleAtFixedRate(Object timerKey, scala.concurrent.duration.FiniteDuration initialDelay, scala.concurrent.duration.FiniteDuration interval) Schedule timer to callonTimer(java.lang.Object)periodically with the givenintervalafter the specified initial delay.protected final voidscheduleOnce(Object timerKey, Duration delay) Schedule timer to callonTimer(java.lang.Object)after given delay.protected final voidscheduleOnce(Object timerKey, scala.concurrent.duration.FiniteDuration delay) Schedule timer to callonTimer(java.lang.Object)after given delay.protected final voidscheduleWithFixedDelay(Object timerKey, Duration initialDelay, Duration interval) Schedule timer to callonTimer(java.lang.Object)periodically with the givendelayafter the specified initial delay.protected final voidscheduleWithFixedDelay(Object timerKey, scala.concurrent.duration.FiniteDuration initialDelay, scala.concurrent.duration.FiniteDuration delay) Schedule timer to callonTimer(java.lang.Object)periodically with the givendelayafter the specified initial delay.Methods inherited from class org.apache.pekko.stream.stage.GraphStageLogic
abortEmitting, abortReading, beforePreStart, cancel, cancel, cancelStage, complete, completeStage, conditionalTerminateInput, conditionalTerminateOutput, createAsyncCallback, eagerTerminateInput, eagerTerminateOutput, emit, emit, emit, emitMultiple, emitMultiple, emitMultiple, emitMultiple, emitMultiple, emitMultiple, emitMultiple, fail, failStage, getAsyncCallback, getEagerStageActor, getHandler, getHandler, getStageActor, grab, hasBeenPulled, ignoreTerminateInput, ignoreTerminateOutput, inCount, isAvailable, isAvailable, isClosed, isClosed, materializer, outCount, passAlong, passAlong$default$3, passAlong$default$4, passAlong$default$5, postStop, preStart, pull, push, read, read, readN, readN, setHandler, setHandler, setHandlers, setKeepGoing, stageActor, stageActorName, subFusingMaterializer, toString, totallyIgnorantInput, tryPull
-
Constructor Details
-
TimerGraphStageLogic
-
-
Method Details
-
afterPostStop
protected void afterPostStop()Description copied from class:GraphStageLogicINTERNAL API- Overrides:
afterPostStopin classGraphStageLogic
-
cancelTimer
Cancel timer, ensuring that theonTimer(java.lang.Object)is not subsequently called.- Parameters:
timerKey- key of the timer to cancel
-
isTimerActive
Inquire whether the timer is still active. Returns true unless the timer does not exist, has previously been canceled or if it was a single-shot timer that was already triggered. -
onTimer
Will be called when the scheduled timer is triggered.- Parameters:
timerKey- key of the scheduled timer- Throws:
Exception
-
scheduleAtFixedRate
protected final void scheduleAtFixedRate(Object timerKey, scala.concurrent.duration.FiniteDuration initialDelay, scala.concurrent.duration.FiniteDuration interval) Schedule timer to callonTimer(java.lang.Object)periodically with the givenintervalafter the specified initial delay. Any existing timer with the same key will automatically be canceled before adding the new timer. -
scheduleAtFixedRate
Schedule timer to callonTimer(java.lang.Object)periodically with the givenintervalafter the specified initial delay. Any existing timer with the same key will automatically be canceled before adding the new timer. -
scheduleOnce
Schedule timer to callonTimer(java.lang.Object)after given delay. Any existing timer with the same key will automatically be canceled before adding the new timer. -
scheduleOnce
Schedule timer to callonTimer(java.lang.Object)after given delay. Any existing timer with the same key will automatically be canceled before adding the new timer. -
scheduleWithFixedDelay
protected final void scheduleWithFixedDelay(Object timerKey, scala.concurrent.duration.FiniteDuration initialDelay, scala.concurrent.duration.FiniteDuration delay) Schedule timer to callonTimer(java.lang.Object)periodically with the givendelayafter the specified initial delay. Any existing timer with the same key will automatically be canceled before adding the new timer. -
scheduleWithFixedDelay
protected final void scheduleWithFixedDelay(Object timerKey, Duration initialDelay, Duration interval) Schedule timer to callonTimer(java.lang.Object)periodically with the givendelayafter the specified initial delay. Any existing timer with the same key will automatically be canceled before adding the new timer.
-