Package org.jclouds.fallbacks
Class HeaderToRetryAfterException
- java.lang.Object
-
- org.jclouds.fallbacks.HeaderToRetryAfterException
-
- All Implemented Interfaces:
Fallback<Object>
,PropagateIfRetryAfter
@Beta public final class HeaderToRetryAfterException extends Object implements PropagateIfRetryAfter
propagates asRetryAfterException
if a Throwable is anHttpResponseException
with aset
and a validHttpHeaders.RETRY_AFTER
header set.- See Also:
- Retry-After format
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static HeaderToRetryAfterException
create(com.google.common.base.Ticker ticker, DateCodec dateCodec)
Object
createOrPropagate(Throwable t)
if input is not of typeHttpResponseException
, this method propagates.com.google.common.base.Optional<RetryAfterException>
tryCreateRetryAfterException(Throwable in, String retryAfter)
returns aRetryAfterException
if parameterretryAfter
corresponds to known formats.
-
-
-
Method Detail
-
create
public static HeaderToRetryAfterException create(com.google.common.base.Ticker ticker, DateCodec dateCodec)
- Parameters:
ticker
- how to read current timedateCodec
- how to parse theHttpHeaders.RETRY_AFTER
header, if it is a Date.- Returns:
-
createOrPropagate
public Object createOrPropagate(Throwable t) throws Exception
Description copied from interface:PropagateIfRetryAfter
if input is not of typeHttpResponseException
, this method propagates. Otherwise,null
, if didn't coerce toRetryAfterException
- Specified by:
createOrPropagate
in interfaceFallback<Object>
- Specified by:
createOrPropagate
in interfacePropagateIfRetryAfter
- Parameters:
t
- the exception that made the call fail.- Throws:
Exception
-
tryCreateRetryAfterException
public com.google.common.base.Optional<RetryAfterException> tryCreateRetryAfterException(Throwable in, String retryAfter)
returns aRetryAfterException
if parameterretryAfter
corresponds to known formats.- See Also:
- Retry-After format
-
-