Package discord4j.common
Class ResettableInterval
java.lang.Object
discord4j.common.ResettableInterval
- All Implemented Interfaces:
Sinks.EmitFailureHandler
Emit ticks at a constant rate specified at
start(Duration, Duration) and will continue until
stop() is called or start(Duration, Duration) is re-invoked, resetting the previous emitter.
The ticks are available from the ticks() method.-
Field Summary
Fields inherited from interface reactor.core.publisher.Sinks.EmitFailureHandler
FAIL_FAST -
Constructor Summary
ConstructorsConstructorDescriptionResettableInterval(Scheduler scheduler) Create aResettableIntervalthat emits ticks on the givenSchedulerupon callingstart(Duration, Duration). -
Method Summary
Modifier and TypeMethodDescriptionbooleanonEmitFailure(SignalType signalType, Sinks.EmitResult result) voidBegin producing ticks at the given rate.voidstop()Dispose the current emitter task without completing or cancelling existing subscriptions toticks().ticks()Return aFluxthat emits ticks at the currently configured rate.
-
Constructor Details
-
ResettableInterval
Create aResettableIntervalthat emits ticks on the givenSchedulerupon callingstart(Duration, Duration).- Parameters:
scheduler- the ReactorSchedulerto use to emit ticks
-
-
Method Details
-
start
Begin producing ticks at the given rate. -
stop
public void stop()Dispose the current emitter task without completing or cancelling existing subscriptions toticks(). -
ticks
Return aFluxthat emits ticks at the currently configured rate.- Returns:
- a
Fluxof increasing values since the laststart(Duration, Duration)call
-
onEmitFailure
- Specified by:
onEmitFailurein interfaceSinks.EmitFailureHandler
-