@Beta public final class HeaderToRetryAfterException extends Object implements PropagateIfRetryAfter
RetryAfterException
if a Throwable is an
HttpResponseException
with a set
and a valid
HttpHeaders.RETRY_AFTER
header set.Modifier and Type | Method and Description |
---|---|
static HeaderToRetryAfterException |
create(com.google.common.base.Ticker ticker,
DateCodec dateCodec) |
Object |
createOrPropagate(Throwable t)
if input is not of type
HttpResponseException , this method propagates. |
com.google.common.base.Optional<RetryAfterException> |
tryCreateRetryAfterException(Throwable in,
String retryAfter)
returns a
RetryAfterException if parameter retryAfter
corresponds to known formats. |
public static HeaderToRetryAfterException create(com.google.common.base.Ticker ticker, DateCodec dateCodec)
ticker
- how to read current timedateCodec
- how to parse the HttpHeaders.RETRY_AFTER
header, if it
is a Date.public Object createOrPropagate(Throwable t) throws Exception
PropagateIfRetryAfter
HttpResponseException
, this method propagates. Otherwise,
null
, if didn't coerce to RetryAfterException
createOrPropagate
in interface Fallback<Object>
createOrPropagate
in interface PropagateIfRetryAfter
t
- the exception that made the call fail.Exception
public com.google.common.base.Optional<RetryAfterException> tryCreateRetryAfterException(Throwable in, String retryAfter)
RetryAfterException
if parameter retryAfter
corresponds to known formats.Copyright © 2009-2021 The Apache Software Foundation. All Rights Reserved.