Package com.yahoo.jrt.slobrok.api
Interface BackOffPolicy
public interface BackOffPolicy
Interface used to control how fast the mirror and register classes
will retry in case of errors. The reset method is used to indicate
that all is ok. When things start failing, the get method will be
invoked for each new attempt in order to get the appropriate delay
between retries (typically increasing for each invocation). The
shouldWarn method is used to ask if a certain delay returned from
get should result in a warning being logged. When things get back
to normal operation, the reset method is invoked to indicate that
we are no longer in a failure state.
-
Method Summary
Modifier and TypeMethodDescriptiondouble
get()
Obtain the number of seconds to wait before the next attempt.void
reset()
Reset backoff logic.boolean
shouldInform
(double t) Check if a certain delay should result in an information message logged.boolean
shouldWarn
(double t) Check if a certain delay should result in a warning being logged.
-
Method Details
-
reset
void reset()Reset backoff logic. -
get
double get()Obtain the number of seconds to wait before the next attempt.- Returns:
- delay in seconds
-
shouldWarn
boolean shouldWarn(double t) Check if a certain delay should result in a warning being logged.- Parameters:
t
- current delay value- Returns:
- true if we should log
-
shouldInform
boolean shouldInform(double t) Check if a certain delay should result in an information message logged.- Parameters:
t
- current delay value- Returns:
- true if we should log
-