Package io.helidon.common.reactive
Interface RetrySchema
-
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface RetrySchema
Defines delay for next read/poll operation in a pollingpublisher
.Schema defines a delay before next poll if the last one did not get new data.
It is possible to use included static factory methods for some standard schemas.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static RetrySchema
constant(long delay)
Creates the retry schema with a constant result.static RetrySchema
geometric(long firstDelay, double ratio, long maxDelay)
Creates the retry schema as a bounded geometric series.static RetrySchema
linear(long firstDelay, long delayIncrement, long maxDelay)
Creates the retry schema with a linear delay increment.long
nextDelay(int retryCount, long lastDelay)
Returns a delay before next read if the last one poll did not get new data.
-
-
-
Method Detail
-
nextDelay
long nextDelay(int retryCount, long lastDelay)
Returns a delay before next read if the last one poll did not get new data.- Parameters:
retryCount
- a count of already poll retries. It is0
when called first time and resets every time when poll returns some data.lastDelay
- a last returned value.0
in first call. Resets when some data are get.- Returns:
- a delay in milliseconds before next poll attempt. If less then zero then
Publisher
completes withonError
message.
-
linear
static RetrySchema linear(long firstDelay, long delayIncrement, long maxDelay)
Creates the retry schema with a linear delay increment. It returnsfirstDelay
for the first call and then it increments it's value for every call bydelayIncrement
until reach a limit defined bymaxDelay
.- Parameters:
firstDelay
- a delay to returns for the first calldelayIncrement
- an increment of the returned value.maxDelay
- the maximal value to return- Returns:
- computed retry delay with a linear increment
-
constant
static RetrySchema constant(long delay)
Creates the retry schema with a constant result.- Parameters:
delay
- a constant delay to return- Returns:
- a
delay
value
-
geometric
static RetrySchema geometric(long firstDelay, double ratio, long maxDelay)
Creates the retry schema as a bounded geometric series.- Parameters:
firstDelay
- a delay to returns for the first callratio
- a geometric series ratiomaxDelay
- the maximal value to return- Returns:
- computed retry delay
-
-