public class DefaultLoadBalancerRetryHandler extends java.lang.Object implements RetryHandler
RetryHandler. The implementation is limited to
known exceptions in java.net. Specific client implementation should provide its own
RetryHandler| Modifier and Type | Field and Description |
|---|---|
protected boolean |
retryEnabled |
protected int |
retryNextServer |
protected int |
retrySameServer |
DEFAULT| Constructor and Description |
|---|
DefaultLoadBalancerRetryHandler() |
DefaultLoadBalancerRetryHandler(IClientConfig clientConfig) |
DefaultLoadBalancerRetryHandler(int retrySameServer,
int retryNextServer,
boolean retryEnabled) |
| Modifier and Type | Method and Description |
|---|---|
protected java.util.List<java.lang.Class<? extends java.lang.Throwable>> |
getCircuitRelatedExceptions() |
int |
getMaxRetriesOnNextServer() |
int |
getMaxRetriesOnSameServer() |
protected java.util.List<java.lang.Class<? extends java.lang.Throwable>> |
getRetriableExceptions() |
boolean |
isCircuitTrippingException(java.lang.Throwable e)
Test if an exception should be treated as circuit failure.
|
boolean |
isRetriableException(java.lang.Throwable e,
boolean sameServer)
Test if an exception is retriable for the load balancer
|
protected final int retrySameServer
protected final int retryNextServer
protected final boolean retryEnabled
public DefaultLoadBalancerRetryHandler()
public DefaultLoadBalancerRetryHandler(int retrySameServer,
int retryNextServer,
boolean retryEnabled)
public DefaultLoadBalancerRetryHandler(IClientConfig clientConfig)
public boolean isRetriableException(java.lang.Throwable e,
boolean sameServer)
RetryHandlerisRetriableException in interface RetryHandlere - the original exceptionsameServer - if true, the method is trying to determine if retry can be
done on the same server. Otherwise, it is testing whether retry can be
done on a different serverpublic boolean isCircuitTrippingException(java.lang.Throwable e)
RetryHandlerConnectException is a circuit failure. This is used to determine
whether successive exceptions of such should trip the circuit breaker to a particular
host by the load balancer. If false but a server response is absent,
load balancer will also close the circuit upon getting such exception.isCircuitTrippingException in interface RetryHandlerSocketException or SocketTimeoutException is a cause in the Throwable.public int getMaxRetriesOnSameServer()
getMaxRetriesOnSameServer in interface RetryHandlerpublic int getMaxRetriesOnNextServer()
getMaxRetriesOnNextServer in interface RetryHandlerprotected java.util.List<java.lang.Class<? extends java.lang.Throwable>> getRetriableExceptions()
protected java.util.List<java.lang.Class<? extends java.lang.Throwable>> getCircuitRelatedExceptions()