}
connectionState = (ConnectionState)hs;
}
FailoverCommandCenter fcc = connectionState.getFailoverCommandCenter();
// non clustered, send the invocation forward
if (fcc == null)
{
return invocation.invokeNext();
}
FailoverValve2 valve = fcc.getValve();
JMSRemotingConnection remotingConnection = null;
String methodName = ((MethodInvocation)invocation).getMethod().getName();
if (methodName.equals("startAfterFailover"))
{
//We don't use the valve on this method
return invocation.invokeNext();
}
boolean left = false;
try
{
valve.enter();
// it's important to retrieve the remotingConnection while inside the Valve
remotingConnection = fcc.getRemotingConnection();
return invocation.invokeNext();
}
catch (MessagingNetworkFailureException e)
{
valve.leave();
left = true;
log.debug(this + " detected network failure, putting " + methodName +
"() on hold until failover completes");
fcc.failureDetected(e, this, remotingConnection);
// Set retry flag as true on send() and sendTransaction()
// more details at http://jira.jboss.org/jira/browse/JBMESSAGING-809
if ((invocation.getTargetObject() instanceof ClientSessionDelegate && methodName.equals("send")) ||