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

java.lang.Object
  extended by ch.elca.el4j.services.exceptionhandler.handler.AbstractExceptionHandler
      extended by ch.elca.el4j.services.exceptionhandler.handler.SequenceExceptionHandler
All Implemented Interfaces:
ExceptionHandler

public class SequenceExceptionHandler
extends AbstractExceptionHandler

This class allows to specify a number of exception handlers that are called in sequence until the first succeeds, i.e. it doesn't throw an exception. In this case, it returns its result. If all exception handler fail, the last caught exception is thrown.

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

Constructor Summary
SequenceExceptionHandler()
           
 
Method Summary
protected  Object handleException(Throwable t, AbstractExceptionHandlerInterceptor exceptionInvoker, org.aopalliance.intercept.MethodInvocation invocation, org.slf4j.Logger logger)
          Handles the given throwable thrown by the method invocation.
 void setExceptionHandlers(ExceptionHandler[] exceptionHandlers)
          Sets the exception handlers.
 
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

SequenceExceptionHandler

public SequenceExceptionHandler()
Method Detail

setExceptionHandlers

public void setExceptionHandlers(ExceptionHandler[] exceptionHandlers)
Sets the exception handlers.

Parameters:
exceptionHandlers - The exception handlers to set.

handleException

protected Object handleException(Throwable t,
                                 AbstractExceptionHandlerInterceptor exceptionInvoker,
                                 org.aopalliance.intercept.MethodInvocation invocation,
                                 org.slf4j.Logger logger)
                          throws Throwable
Handles the given throwable thrown by the method invocation. This method is called with the appropriate logger.

Specified by:
handleException in class AbstractExceptionHandler
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:
Throwable - Any exception thrown by the handler.


Copyright © 2005-2011 ELCA. All Rights Reserved.