public class CircuitBreakerRetryPolicy extends Object implements RetryPolicy
Modifier and Type | Field and Description |
---|---|
static String |
CIRCUIT_OPEN |
static String |
CIRCUIT_SHORT_COUNT |
Constructor and Description |
---|
CircuitBreakerRetryPolicy() |
CircuitBreakerRetryPolicy(RetryPolicy delegate) |
Modifier and Type | Method and Description |
---|---|
boolean |
canRetry(RetryContext context) |
void |
close(RetryContext context) |
RetryContext |
open(RetryContext parent)
Acquire resources needed for the retry operation.
|
void |
registerThrowable(RetryContext context,
Throwable throwable)
Called once per retry attempt, after the callback fails.
|
void |
setOpenTimeout(long timeout)
Timeout for tripping the open circuit.
|
void |
setResetTimeout(long timeout)
Timeout for resetting circuit in milliseconds.
|
public static final String CIRCUIT_OPEN
public static final String CIRCUIT_SHORT_COUNT
public CircuitBreakerRetryPolicy()
public CircuitBreakerRetryPolicy(RetryPolicy delegate)
public void setResetTimeout(long timeout)
timeout
- the timeout to set in millisecondspublic void setOpenTimeout(long timeout)
timeout
- the timeout to set in millisecondspublic boolean canRetry(RetryContext context)
canRetry
in interface RetryPolicy
context
- the current retry statuspublic RetryContext open(RetryContext parent)
RetryPolicy
open
in interface RetryPolicy
parent
- the parent context if we are in a nested retry.RetryContext
object specific to this policy.public void close(RetryContext context)
close
in interface RetryPolicy
context
- a retry status created by the
RetryPolicy.open(RetryContext)
method of this policy.public void registerThrowable(RetryContext context, Throwable throwable)
RetryPolicy
registerThrowable
in interface RetryPolicy
context
- the current status object.throwable
- the exception to throwCopyright © 2018 SpringSource. All rights reserved.