public class FailoverInvoker extends HotSwappingInvoker
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
Constructor and Description |
---|
FailoverInvoker(java.lang.Class[] types,
ProxyFactory proxyFactory,
java.lang.Object[] delegates,
java.lang.Class 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, proxy
equals, getDelegateReference, getMethodToInvoke, getProxyFactory, hashCode
public FailoverInvoker(java.lang.Class[] types, ProxyFactory proxyFactory, java.lang.Object[] delegates, java.lang.Class exceptionClass)
types
- the types of the proxyproxyFactory
- the ProxyFactory
to usedelegates
- the delegates to useexceptionClass
- the type of the exceptionjava.lang.IllegalArgumentException
- if exceptionClass is not a Throwable
protected java.lang.Object invokeOnDelegate(java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.reflect.InvocationTargetException
DelegatingInvoker
invokeOnDelegate
in class DelegatingInvoker
method
- the method to invokeargs
- the arguments for the invocationjava.lang.reflect.InvocationTargetException
- if the invoked method throws any exception