Class RetryRuleBuilder
java.lang.Object
com.linecorp.armeria.client.AbstractRuleBuilder
com.linecorp.armeria.client.retry.RetryRuleBuilder
public final class RetryRuleBuilder extends AbstractRuleBuilder
A builder for creating a new
RetryRule
.-
Method Summary
Modifier and Type Method Description RetryRuleBuilder
onException()
RetryRuleBuilder
onException(Class<? extends Throwable> exception)
RetryRuleBuilder
onException(Predicate<? super Throwable> exceptionFilter)
RetryRuleBuilder
onResponseHeaders(Predicate<? super ResponseHeaders> responseHeadersFilter)
Adds the specifiedresponseHeadersFilter
for aRetryRule
which will retry if theresponseHeadersFilter
returnstrue
.RetryRuleBuilder
onServerErrorStatus()
Adds theHttpStatusClass.SERVER_ERROR
for aRetryRule
which will retry if a class of the response status isHttpStatusClass.SERVER_ERROR
.RetryRuleBuilder
onStatus(HttpStatus... statuses)
Adds the specifiedHttpStatus
es for aRetryRule
which will retry if a response status is one of the specifiedHttpStatus
es.RetryRuleBuilder
onStatus(Iterable<HttpStatus> statuses)
Adds the specifiedHttpStatus
es for aRetryRule
which will retry if a response status is one of the specifiedHttpStatus
es.RetryRuleBuilder
onStatus(Predicate<? super HttpStatus> statusFilter)
Adds the specifiedstatusFilter
for aRetryRule
which will retry if a response status matches the specifiedstatusFilter
.RetryRuleBuilder
onStatusClass(HttpStatusClass... statusClasses)
Adds the specifiedHttpStatusClass
es for aRetryRule
which will retry if a class of the response status is one of the specifiedHttpStatusClass
es.RetryRuleBuilder
onStatusClass(Iterable<HttpStatusClass> statusClasses)
Adds the specifiedHttpStatusClass
es for aRetryRule
which will retry if a class of the response status is one of the specifiedHttpStatusClass
es.RetryRuleBuilder
onUnprocessed()
Makes aRetryRule
retry on anUnprocessedRequestException
which means that the request has not been processed by the server.RetryRule
thenBackoff()
Sets the default backoff and returns a newly createdRetryRule
.RetryRule
thenBackoff(Backoff backoff)
RetryRule
thenNoRetry()
Returns a newly createdRetryRule
that never retries.String
toString()
Methods inherited from class com.linecorp.armeria.client.AbstractRuleBuilder
exceptionFilter, requestHeadersFilter, responseHeadersFilter
-
Method Details
-
thenBackoff
Sets the default backoff and returns a newly createdRetryRule
. -
thenBackoff
-
thenNoRetry
Returns a newly createdRetryRule
that never retries. -
toString
-
onResponseHeaders
public RetryRuleBuilder onResponseHeaders(Predicate<? super ResponseHeaders> responseHeadersFilter)Adds the specifiedresponseHeadersFilter
for aRetryRule
which will retry if theresponseHeadersFilter
returnstrue
.- Overrides:
onResponseHeaders
in classAbstractRuleBuilder
-
onStatusClass
Adds the specifiedHttpStatusClass
es for aRetryRule
which will retry if a class of the response status is one of the specifiedHttpStatusClass
es.- Overrides:
onStatusClass
in classAbstractRuleBuilder
-
onStatusClass
Adds the specifiedHttpStatusClass
es for aRetryRule
which will retry if a class of the response status is one of the specifiedHttpStatusClass
es.- Overrides:
onStatusClass
in classAbstractRuleBuilder
-
onServerErrorStatus
Adds theHttpStatusClass.SERVER_ERROR
for aRetryRule
which will retry if a class of the response status isHttpStatusClass.SERVER_ERROR
.- Overrides:
onServerErrorStatus
in classAbstractRuleBuilder
-
onStatus
Adds the specifiedHttpStatus
es for aRetryRule
which will retry if a response status is one of the specifiedHttpStatus
es.- Overrides:
onStatus
in classAbstractRuleBuilder
-
onStatus
Adds the specifiedHttpStatus
es for aRetryRule
which will retry if a response status is one of the specifiedHttpStatus
es.- Overrides:
onStatus
in classAbstractRuleBuilder
-
onStatus
Adds the specifiedstatusFilter
for aRetryRule
which will retry if a response status matches the specifiedstatusFilter
.- Overrides:
onStatus
in classAbstractRuleBuilder
-
onException
Adds the specified exception type for aRetryRule
which will retry if anException
is raised and it is an instance of the specifiedexception
.- Overrides:
onException
in classAbstractRuleBuilder
-
onException
Adds the specifiedexceptionFilter
for aRetryRule
which will retry if anException
is raised and the specifiedexceptionFilter
returnstrue
.- Overrides:
onException
in classAbstractRuleBuilder
-
onException
- Overrides:
onException
in classAbstractRuleBuilder
-
onUnprocessed
Makes aRetryRule
retry on anUnprocessedRequestException
which means that the request has not been processed by the server. Therefore, you can safely retry the request without worrying about the idempotency of the request.- Overrides:
onUnprocessed
in classAbstractRuleBuilder
-