{
log.trace("Invocation returned exception: " + response);
}
if(response instanceof GenericClusteringException)
{
GenericClusteringException gcex = (GenericClusteringException) response;
lastException = gcex;
// this is a generic clustering exception that contain the
// completion status: usefull to determine if we are authorized
// to re-issue a query to another node
//
if(gcex.getCompletionStatus() == GenericClusteringException.COMPLETED_NO)
{
// we don't want to remove the node from the list of failed
// node UNLESS there is a risk to indefinitively loop
//
if(totalNumberOfTargets() >= failoverCounter)
{
if(!gcex.isDefinitive())
{
definitivlyRemoveNodeOnFailure = false;
}
}
removeDeadTarget(getLocator());
if(!definitivlyRemoveNodeOnFailure)
{
resetView();
}
failoverAuthorized = txContextAllowsFailover(invocation);
failoverCounter++;
invocation.setValue("FAILOVER_COUNTER", new Integer(failoverCounter), PayloadKey.AS_IS);
if (trace)
{
log.trace("Received GenericClusteringException where request was not completed. Will retry if transaction failover is authorised.");
}
continue;
}
else
{
invocationHasReachedAServer(invocation);
throw new ServerException("Clustering error", gcex);
}
}
else
{
throw ((Exception) response);
}
}
if(response instanceof MarshalledObject)
{
haResponse = (HARMIResponse) ((MarshalledObject) response).get();
}
else
{
haResponse = (HARMIResponse) response;
}
// check for clustered targets
if(haResponse.newReplicants != null)
{
updateClusterInfo(haResponse.newReplicants, haResponse.currentViewId);
}
response = haResponse.response;
invocationHasReachedAServer(invocation);
return response;
}
catch(CannotConnectException cncEx)
{
if (trace)
{
log.trace("Invocation failed: CannotConnectException - " + cncEx, cncEx);
}
removeDeadTarget(getLocator());
resetView();
failoverAuthorized = txContextAllowsFailover(invocation);
failoverCounter++;
invocation.setValue("FAILOVER_COUNTER", new Integer(failoverCounter), PayloadKey.AS_IS);
}
catch(GenericClusteringException gcex)
{
lastException = gcex;
// this is a generic clustering exception that contain the
// completion status: usefull to determine if we are authorized
// to re-issue a query to another node
//
if(gcex.getCompletionStatus() == GenericClusteringException.COMPLETED_NO)
{
// we don't want to remove the node from the list of failed
// node UNLESS there is a risk to indefinitively loop
//
if(totalNumberOfTargets() >= failoverCounter)
{
if(!gcex.isDefinitive())
{
definitivlyRemoveNodeOnFailure = false;
}
}
removeDeadTarget(getLocator());