}
}
public BrokerDetails getNextBrokerDetails()
{
BrokerDetails broker = null;
synchronized(_brokerListLock)
{
if (_currentBrokerIndex == (_connectionDetails.getBrokerCount() - 1))
{
_currentBrokerIndex = 0;
}
else
{
_currentBrokerIndex++;
}
broker = _connectionDetails.getBrokerDetails(_currentBrokerIndex);
// When the broker list is updated it will include the current broker as well
// There is no point trying it again, so trying the next one.
if (_currentBrokerDetail != null &&
broker.getHost().equals(_currentBrokerDetail.getHost()) &&
broker.getPort() == _currentBrokerDetail.getPort())
{
if (_connectionDetails.getBrokerCount() > 1)
{
return getNextBrokerDetails();
}
else
{
_failedAttemps ++;
return null;
}
}
}
String delayStr = broker.getProperty(BrokerDetails.OPTIONS_CONNECT_DELAY);
if (delayStr != null)
{
Long delay = Long.parseLong(delayStr);
_logger.info("Delay between connect retries:" + delay);
try