|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mule.AbstractExceptionListener
public abstract class AbstractExceptionListener
AbstractExceptionListener is a base implementation that custom
Exception Listeners can override. It provides template methods for handling the
for base types of exceptions plus allows multimple endpoints to be associated with
this exception listener and provides an implementation for dispatching exception
events from this Listener.
| Field Summary | |
|---|---|
protected WildcardFilter |
commitTxFilter
|
protected boolean |
enableNotifications
|
protected List<OutboundEndpoint> |
endpoints
|
protected AtomicBoolean |
initialised
|
protected Log |
logger
logger used by this class |
protected MuleContext |
muleContext
|
protected WildcardFilter |
rollbackTxFilter
|
| Fields inherited from interface org.mule.api.lifecycle.Initialisable |
|---|
PHASE_NAME |
| Fields inherited from interface org.mule.api.lifecycle.Disposable |
|---|
PHASE_NAME |
| Constructor Summary | |
|---|---|
AbstractExceptionListener()
|
|
| Method Summary | |
|---|---|
void |
addEndpoint(OutboundEndpoint endpoint)
|
protected void |
closeStream(MuleMessage message)
|
protected OutboundRouter |
createOutboundRouter()
|
void |
dispose()
A lifecycle method where implementor should free up any resources. |
protected void |
doInitialise(MuleContext muleContext)
|
void |
exceptionThrown(Exception e)
|
protected void |
fireNotification(ExceptionNotification notification)
Fires a server notification to all registered ExceptionNotificationListener
eventManager. |
WildcardFilter |
getCommitTxFilter()
|
List<OutboundEndpoint> |
getEndpoints()
|
protected List<OutboundEndpoint> |
getEndpoints(Throwable t)
Returns an endpoint for the given exception. |
protected Throwable |
getExceptionType(Throwable t,
Class exceptionType)
|
MuleMessage |
getReturnMessage()
|
WildcardFilter |
getRollbackTxFilter()
|
abstract void |
handleLifecycleException(Object component,
Throwable e)
DefaultLifecyclePhase exceptions are thrown when an error occurs during an object's lifecycle call such as start, stop or initialise. |
abstract void |
handleMessagingException(MuleMessage message,
Throwable e)
A messaging exception is thrown when an excpetion occurs during normal message processing. |
abstract void |
handleRoutingException(MuleMessage message,
ImmutableEndpoint endpoint,
Throwable e)
A routing exception is thrown when an excpetion occurs during normal message processing A RoutingException holds a reference to the current
message and te endpoint being routing to or from when the error occurred. |
abstract void |
handleStandardException(Throwable e)
A handler for all other exceptions |
protected void |
handleTransaction(Throwable t)
If there is a current transaction this method will mark it for rollback This method should not be called if an event is routed from this exception handler to an endpoint that should take part in the current transaction |
void |
initialise()
The initialise method is call every time the Exception stategy is assigned to a service or connector. |
boolean |
isEnableNotifications()
|
boolean |
isInitialised()
|
protected void |
logException(Throwable t)
Used to log the error passed into this Exception Listener |
protected void |
logFatal(MuleMessage message,
Throwable t)
Logs a fatal error message to the logging system. |
boolean |
removeEndpoint(OutboundEndpoint endpoint)
|
protected void |
rollbackTransaction()
|
protected void |
routeException(MuleMessage message,
ImmutableEndpoint failedEndpoint,
Throwable t)
Routes the current exception to an error endpoint such as a Dead Letter Queue (jms) This method is only invoked if there is a MuleMessage available to dispatch. |
void |
setCommitTxFilter(WildcardFilter commitTxFilter)
|
void |
setEnableNotifications(boolean enableNotifications)
|
void |
setEndpoints(List<OutboundEndpoint> endpoints)
|
void |
setMuleContext(MuleContext context)
|
void |
setReturnMessage(MuleMessage returnMessage)
Set a message to be returned to the caller as a result of this exception handling. |
void |
setReturnMessage(Object returnMessage)
Set a message to be returned to the caller as a result of this exception handling. |
void |
setRollbackTxFilter(WildcardFilter rollbackTxFilter)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected transient Log logger
protected List<OutboundEndpoint> endpoints
protected AtomicBoolean initialised
protected MuleContext muleContext
protected WildcardFilter rollbackTxFilter
protected WildcardFilter commitTxFilter
protected boolean enableNotifications
| Constructor Detail |
|---|
public AbstractExceptionListener()
| Method Detail |
|---|
public void setMuleContext(MuleContext context)
setMuleContext in interface MuleContextAwarepublic List<OutboundEndpoint> getEndpoints()
public void setEndpoints(List<OutboundEndpoint> endpoints)
public void addEndpoint(OutboundEndpoint endpoint)
public boolean removeEndpoint(OutboundEndpoint endpoint)
public void exceptionThrown(Exception e)
exceptionThrown in interface ExceptionListener
protected Throwable getExceptionType(Throwable t,
Class exceptionType)
public final void initialise()
throws InitialisationException
doInitialise() method.
initialise in interface InitialisableInitialisationException
RecoverableException - if an error occurs that can be recovered from
protected void doInitialise(MuleContext muleContext)
throws InitialisationException
InitialisationExceptionprotected void handleTransaction(Throwable t)
protected void rollbackTransaction()
protected void routeException(MuleMessage message,
ImmutableEndpoint failedEndpoint,
Throwable t)
ExceptionMessage which contains the exception thrown the
MuleMessage and any context information.
message - the MuleMessage being processed when the exception occurredfailedEndpoint - optional; the endpoint being dispatched or received on
when the error occurred. This is NOT the endpoint that the message
will be disptched on and is only supplied to this method for
logging purposest - the exception thrown. This will be sent with the ExceptionMessageExceptionMessageprotected OutboundRouter createOutboundRouter()
protected void closeStream(MuleMessage message)
protected List<OutboundEndpoint> getEndpoints(Throwable t)
t - the exception thrown
protected void logException(Throwable t)
t - the exception thrown
protected void logFatal(MuleMessage message,
Throwable t)
message - The MuleMessage currently being processedt - the fatal exception to logpublic boolean isInitialised()
public void dispose()
Disposable
dispose in interface Disposableprotected void fireNotification(ExceptionNotification notification)
ExceptionNotificationListener
eventManager.
notification - the notification to fire.public WildcardFilter getCommitTxFilter()
public void setCommitTxFilter(WildcardFilter commitTxFilter)
public boolean isEnableNotifications()
public void setEnableNotifications(boolean enableNotifications)
public WildcardFilter getRollbackTxFilter()
public void setRollbackTxFilter(WildcardFilter rollbackTxFilter)
public abstract void handleMessagingException(MuleMessage message,
Throwable e)
MessagingException holds a reference to the current
message that is passed into this method
message - the current message being processede - the top level exception thrown. This may be a Messaging exception or
some wrapper exceptionMessagingException
public abstract void handleRoutingException(MuleMessage message,
ImmutableEndpoint endpoint,
Throwable e)
RoutingException holds a reference to the current
message and te endpoint being routing to or from when the error occurred. Both
are passed into this method
message - the current message being processedendpoint - the endpoint being dispatched to or received from when the
error occurrede - the top level exception thrown. This may be a Messaging exception or
some wrapper exceptionRoutingException
public abstract void handleLifecycleException(Object component,
Throwable e)
component - the object that failed during a lifecycle calle - the top level exception thrown. This may or may not be the
LifecycleException but a lifecycle exception will be
present in the exception stack.LifecycleExceptionpublic abstract void handleStandardException(Throwable e)
e - the top level exception thrownpublic MuleMessage getReturnMessage()
public void setReturnMessage(MuleMessage returnMessage)
public void setReturnMessage(Object returnMessage)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||