com.thoughtworks.proxy.toys.failover
Class FailoverInvoker<T>
java.lang.Object
com.thoughtworks.proxy.toys.delegate.DelegatingInvoker<Object>
com.thoughtworks.proxy.toys.hotswap.HotSwappingInvoker<T>
com.thoughtworks.proxy.toys.failover.FailoverInvoker<T>
- All Implemented Interfaces:
- Invoker, Serializable
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.
- Since:
- 0.1
- Author:
- Dan North, Aslak Hellesøy, Jörg Schaible
- See Also:
- Serialized Form
FailoverInvoker
public FailoverInvoker(Class<?>[] types,
ProxyFactory proxyFactory,
T[] delegates,
Class<? extends Throwable> exceptionClass)
- Construct a FailoverInvoker.
- Parameters:
types
- the types of the proxyproxyFactory
- the ProxyFactory
to usedelegates
- the delegates to useexceptionClass
- the type of the exception- Since:
- 0.1
invokeOnDelegate
protected Object invokeOnDelegate(Method method,
Object[] args)
throws InvocationTargetException
- Description copied from class:
DelegatingInvoker
- Invoke the given method on the delegate.
- Overrides:
invokeOnDelegate
in class DelegatingInvoker<Object>
- Parameters:
method
- the method to invokeargs
- the arguments for the invocation
- Returns:
- the method's result
- Throws:
InvocationTargetException
- if the invoked method throws any exception
Copyright © 2005-2010 Codehaus. All Rights Reserved.