prevent infinite loop if we don't know of any unconnected hosts
This commit is contained in:
@@ -56,7 +56,7 @@ class ConnectionEstablisher {
|
|||||||
if (inProgress.size() >= CONCURRENT)
|
if (inProgress.size() >= CONCURRENT)
|
||||||
return
|
return
|
||||||
|
|
||||||
def toTry
|
def toTry = null
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
toTry = hostCache.getHosts(1)
|
toTry = hostCache.getHosts(1)
|
||||||
if (toTry.isEmpty())
|
if (toTry.isEmpty())
|
||||||
@@ -67,7 +67,8 @@ class ConnectionEstablisher {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (toTry == null)
|
||||||
|
return
|
||||||
inProgress.add(toTry)
|
inProgress.add(toTry)
|
||||||
executor.execute({connect(toTry)} as Runnable)
|
executor.execute({connect(toTry)} as Runnable)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user