ch.elca.el4j.services.exceptionhandler.handler
Class AbstractSwappableTargetExceptionHandler
java.lang.Object
ch.elca.el4j.services.exceptionhandler.handler.AbstractExceptionHandler
ch.elca.el4j.services.exceptionhandler.handler.AbstractRetryExceptionHandler
ch.elca.el4j.services.exceptionhandler.handler.AbstractSwappableTargetExceptionHandler
- All Implemented Interfaces:
- ExceptionHandler
- Direct Known Subclasses:
- RoundRobinSwappableTargetExceptionHandler
public abstract class AbstractSwappableTargetExceptionHandler
- extends AbstractRetryExceptionHandler
This class simplifies the implementation of exception handlers that use
another implementation with the same interface to fulfil the callers
invocation.
- Author:
- Andreas Bur (ABU)
- See Also:
AbstractReconfigureExceptionHandler
- File-location:
- AbstractSwappableTargetExceptionHandler
- Last check-in date:
- 2009-08-04 13:59:45 +0200 (Di, 04. Aug 2009) by swismer for revision 3873
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractSwappableTargetExceptionHandler
public AbstractSwappableTargetExceptionHandler()
setSwapper
public void setSwapper(HotSwappableTargetSource swapper)
- Sets the TargetSource that is used in the proxy, where the target has to
be swapped.
- Parameters:
swapper
- The TargetSource to set.
retry
protected Object retry(Throwable t,
AbstractExceptionHandlerInterceptor exceptionInvoker,
org.aopalliance.intercept.MethodInvocation invocation,
org.slf4j.Logger logger)
throws InappropriateHandlerException,
RetryException
- Creates a new retry exception. Subclasses may also do some other tasks
(e.g. waiting). This method is called only if the number of retires is
not already exceeded.
- Specified by:
retry
in class AbstractRetryExceptionHandler
- Parameters:
t
- The exception thrown in the method invocation.exceptionInvoker
- The exception invoker that called this exception handler.invocation
- The original method invocation.logger
- The logger to be used by subclasses.
- Returns:
- Returns an object that is treated as the original invocation's
return value.
- Throws:
InappropriateHandlerException
RetryException
getNewTarget
protected abstract Object getNewTarget(Object current,
Throwable t,
org.aopalliance.intercept.MethodInvocation invocation,
org.slf4j.Logger logger)
throws RetryException,
Throwable
- Determines a new target to be used by the proxy.
- Parameters:
current
- The current target which the proxy is working on.t
- The exception that caused this strategy. Subclasses may distinguish
between different exception types.invocation
- The original invocation that failed.logger
- The logger.
- Returns:
- Returns an alternative bean that implements the same interface
as the original one.
- Throws:
RetryException
- Signals that the complete invocation has to be rerun.
Throwable
- Whenever something goes wrong.
Copyright © 2005-2011 ELCA. All Rights Reserved.