public class ExceptionClassifierRetryPolicy extends Object implements RetryPolicy
RetryPolicy
that dynamically adapts to one of a set of injected
policies according to the value of the latest exception.Constructor and Description |
---|
ExceptionClassifierRetryPolicy() |
Modifier and Type | Method and Description |
---|---|
boolean |
canRetry(RetryContext context)
Delegate to the policy currently activated in the context.
|
void |
close(RetryContext context)
Delegate to the policy currently activated in the context.
|
RetryContext |
open(RetryContext parent)
Create an active context that proxies a retry policy by choosing a target
from the policy map.
|
void |
registerThrowable(RetryContext context,
Throwable throwable)
Delegate to the policy currently activated in the context.
|
void |
setExceptionClassifier(Classifier<Throwable,RetryPolicy> exceptionClassifier)
Setter for an exception classifier.
|
void |
setPolicyMap(Map<Class<? extends Throwable>,RetryPolicy> policyMap)
Setter for policy map used to create a classifier.
|
public void setPolicyMap(Map<Class<? extends Throwable>,RetryPolicy> policyMap)
policyMap
- a map of Throwable class to RetryPolicy
that
will be used to create a Classifier
to locate a policy.public void setExceptionClassifier(Classifier<Throwable,RetryPolicy> exceptionClassifier)
exceptionClassifier
- ExceptionClassifier to usepublic boolean canRetry(RetryContext context)
canRetry
in interface RetryPolicy
context
- the current retry statusRetryPolicy.canRetry(org.springframework.retry.RetryContext)
public void close(RetryContext context)
close
in interface RetryPolicy
context
- a retry status created by the
RetryPolicy.open(RetryContext)
method of this policy.RetryPolicy.close(org.springframework.retry.RetryContext)
public RetryContext open(RetryContext parent)
open
in interface RetryPolicy
parent
- the parent context if we are in a nested retry.RetryContext
object specific to this policy.RetryPolicy.open(RetryContext)
public void registerThrowable(RetryContext context, Throwable throwable)
registerThrowable
in interface RetryPolicy
context
- the current status object.throwable
- the exception to throwRetryPolicy.registerThrowable(org.springframework.retry.RetryContext,
Throwable)
Copyright © 2018 SpringSource. All rights reserved.