// forward the exception to delegate listener and JMS ExceptionListeners; synchronize
// to avoid race conditions
ExceptionListener jmsExceptionListenerCopy;
ConnectionFailureListener remotingListenerCopy;
synchronized(this)
{
jmsExceptionListenerCopy = jmsExceptionListener;
remotingListenerCopy = remotingListener;
}
boolean forwardToJMSListener = true;
if (remotingListenerCopy != null)
{
try
{
log.trace(this + " forwarding remoting failure \"" + throwable + "\" to " + remotingListenerCopy);
//We only forward to the JMS listener if failover did not successfully handle the exception
//If failover handled the exception transparently then there is effectively no problem
//with the logical connection that the client needs to be aware of
forwardToJMSListener = !remotingListenerCopy.handleConnectionException(throwable, client);
}
catch(Exception e)
{
log.warn("Failed to forward " + throwable + " to " + remotingListenerCopy, e);
}