RollingConfigAdvanceAttempt activeAttempt = rollingConfigAdvanceAttempt.get();
RemoteInstanceRequest.Result result;
if ( (activeAttempt == null) || !activeAttempt.getHostname().equals(state.getCurrentRollingHostname()) || (activeAttempt.getAttemptCount() < maxAttempts) )
{
RemoteInstanceRequest remoteInstanceRequest = new RemoteInstanceRequest(exhibitor, state.getCurrentRollingHostname());
result = callRemoteInstanceRequest(remoteInstanceRequest);
if ( activeAttempt == null )
{
activeAttempt = new RollingConfigAdvanceAttempt(state.getCurrentRollingHostname());
rollingConfigAdvanceAttempt.set(activeAttempt);
}
activeAttempt.incrementAttemptCount();
if ( result.errorMessage.length() != 0 )
{
if ( activeAttempt.getAttemptCount() >= maxAttempts )
{
exhibitor.getLog().add(ActivityLog.Type.INFO, "Exhausted attempts to connect to " + remoteInstanceRequest.getHostname() + " - skipping and moving on to next instance");
newCollection = checkNextInstanceState(config, rollingHostNames, rollingHostNamesIndex + 1); // it must be down. Skip it.
}
else
{
exhibitor.getLog().add(ActivityLog.Type.INFO, "Could not connect to " + remoteInstanceRequest.getHostname() + " - attempt #" + activeAttempt.getAttemptCount());
newCollection = null;
}
}
}
else