public class FailoverInvoker<T> extends HotSwappingInvoker<T>
Invoker that implements a failover strategy by using different delegates in
case of an exception. The implemented strategy is a simple round-robin algorithm to change the delegate in case of a
relevant exception.HotSwappingInvoker.CycleCheck| Modifier and Type | Field and Description |
|---|---|
private int |
current |
private T[] |
delegates |
private java.lang.Class<? extends java.lang.Throwable> |
exceptionClass |
private static long |
serialVersionUID |
| Constructor and Description |
|---|
FailoverInvoker(java.lang.Class<?>[] types,
ProxyFactory proxyFactory,
T[] delegates,
java.lang.Class<? extends java.lang.Throwable> exceptionClass)
Construct a FailoverInvoker.
|
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.Object |
invokeOnDelegate(java.lang.reflect.Method method,
java.lang.Object[] args)
Invoke the given method on the delegate.
|
delegate, hotswap, invoke, proxyequals, getDelegateReference, getMethodToInvoke, getProxyFactory, hashCodeprivate static final long serialVersionUID
private T[] delegates
private java.lang.Class<? extends java.lang.Throwable> exceptionClass
private int current
public FailoverInvoker(java.lang.Class<?>[] types,
ProxyFactory proxyFactory,
T[] delegates,
java.lang.Class<? extends java.lang.Throwable> exceptionClass)
types - the types of the proxyproxyFactory - the ProxyFactory to usedelegates - the delegates to useexceptionClass - the type of the exceptionprotected java.lang.Object invokeOnDelegate(java.lang.reflect.Method method,
java.lang.Object[] args)
throws java.lang.reflect.InvocationTargetException
DelegatingInvokerinvokeOnDelegate in class DelegatingInvoker<java.lang.Object>method - the method to invokeargs - the arguments for the invocationjava.lang.reflect.InvocationTargetException - if the invoked method throws any exception