int maxValue = runningSum[lastIndex] + 1;
int testValue = getRandomIndex(maxValue);
int ignoreIndex = -1;
for (int i = firstIndex; i < (lastIndex + 1); i++) {
SRVRecord srv = (SRVRecord) records[i];
// logger.log(Level.FINE, "SRVRecord.toString():" + srv.toString());
if (runningSum[i] >= testValue) {
// this is it
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, "found srv:" + srv.toString());
}
TargetTuple targetTuple =
lookupNameFromSRV(srv, theProtocol);
if(targetTuple != null){
return targetTuple;
}
else{
ignoreIndex = i;
}
}
}
//Since selective lookup failed, iterate over complete list
for (int i = firstIndex; i < (lastIndex + 1); i++) {
if(i == ignoreIndex){
continue;
}
SRVRecord srv = (SRVRecord) records[i];
TargetTuple targetTuple =
lookupNameFromSRV(srv, theProtocol);
if(targetTuple != null){
return targetTuple;