java.lang.Object
com.maybeitssquid.retry.LimitRetryAfter
- All Implemented Interfaces:
Predicate<jakarta.servlet.http.HttpServletResponse>
public class LimitRetryAfter
extends Object
implements Predicate<jakarta.servlet.http.HttpServletResponse>
Predicate to prevent a retry if there is a
Retry-After header that specifies too long a
wait interval.-
Constructor Summary
ConstructorsConstructorDescriptionLimitRetryAfter(Duration maximum, Function<jakarta.servlet.http.HttpServletResponse, Optional<Duration>> parser) Creates a predicate to limit intervals requested by an HTTP Retry-After header. -
Method Summary
Modifier and TypeMethodDescriptionGets the maximum wait interval allowedstatic LimitRetryAftermaximum(long milliseconds) Convenience wrapper to express the limit in milliseconds.static LimitRetryAfterCreates a predicate to limit intervals requested by an HTTP Retry-After header, using an extended parser.booleantest(jakarta.servlet.http.HttpServletResponse t) Tests whether there is a Retry-After header that would exceed the limit.
-
Constructor Details
-
Method Details
-
maximum
Creates a predicate to limit intervals requested by an HTTP Retry-After header, using an extended parser.- Parameters:
limit- the maximum wait interval- Returns:
- a limiter predicate
- See Also:
-
maximum
Convenience wrapper to express the limit in milliseconds.- Parameters:
milliseconds- the limit in milliseconds- Returns:
- a limiter predicate
- See Also:
-
getMaximum
Gets the maximum wait interval allowed- Returns:
- the maximum wait interval allowed
-
test
public boolean test(jakarta.servlet.http.HttpServletResponse t) Tests whether there is a Retry-After header that would exceed the limit.
-