ch.elca.el4j.services.exceptionhandler.handler
Class RoundRobinSwappableTargetExceptionHandler

java.lang.Object
  extended by ch.elca.el4j.services.exceptionhandler.handler.AbstractExceptionHandler
      extended by ch.elca.el4j.services.exceptionhandler.handler.AbstractRetryExceptionHandler
          extended by ch.elca.el4j.services.exceptionhandler.handler.AbstractSwappableTargetExceptionHandler
              extended by ch.elca.el4j.services.exceptionhandler.handler.RoundRobinSwappableTargetExceptionHandler
All Implemented Interfaces:
ExceptionHandler, InitializingBean

public class RoundRobinSwappableTargetExceptionHandler
extends AbstractSwappableTargetExceptionHandler
implements InitializingBean

This class implements a round robin strategy to swap a proxy's target. It even supports repairing targets that are not contained in the list of alternative targets.

Author:
Andreas Bur (ABU)
File-location:
RoundRobinSwappableTargetExceptionHandler
Last check-in date:
2009-08-04 15:35:01 +0200 (Di, 04. Aug 2009) by swismer for revision 3883

Constructor Summary
RoundRobinSwappableTargetExceptionHandler()
           
 
Method Summary
 void afterPropertiesSet()
          
protected  Object getNewTarget(Object current, Throwable t, org.aopalliance.intercept.MethodInvocation invocation, org.slf4j.Logger logger)
          Determines a new target to be used by the proxy.
 void setTargets(List targets)
          Sets the list of targets that are used one after the other if the current target doesn't work anymore.
 
Methods inherited from class ch.elca.el4j.services.exceptionhandler.handler.AbstractSwappableTargetExceptionHandler
retry, setSwapper
 
Methods inherited from class ch.elca.el4j.services.exceptionhandler.handler.AbstractRetryExceptionHandler
getRetries, handleException, setRetries
 
Methods inherited from class ch.elca.el4j.services.exceptionhandler.handler.AbstractExceptionHandler
getInvocationDescription, handleException, setUseDynamicLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RoundRobinSwappableTargetExceptionHandler

public RoundRobinSwappableTargetExceptionHandler()
Method Detail

setTargets

public void setTargets(List targets)
Sets the list of targets that are used one after the other if the current target doesn't work anymore.

Parameters:
targets - The list of targets to set.

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception

Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

getNewTarget

protected Object getNewTarget(Object current,
                              Throwable t,
                              org.aopalliance.intercept.MethodInvocation invocation,
                              org.slf4j.Logger logger)
                       throws Throwable
Determines a new target to be used by the proxy.

Specified by:
getNewTarget in class AbstractSwappableTargetExceptionHandler
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.