do not to unverified if already in verified
This commit is contained in:
@@ -26,7 +26,9 @@ class HostPool {
|
||||
}
|
||||
|
||||
synchronized def addUnverified(host) {
|
||||
unverified.add(host)
|
||||
if (!verified.contains(host)) {
|
||||
unverified.add(host)
|
||||
}
|
||||
}
|
||||
|
||||
synchronized def getUnverified(int max) {
|
||||
|
@@ -160,4 +160,14 @@ class HostPoolTest {
|
||||
assert hp.getVerified(10,true).isEmpty()
|
||||
assert hp.getUnverified(10).size() == 1
|
||||
}
|
||||
|
||||
@Test
|
||||
void doNotAddIfVerified() {
|
||||
hp.addUnverified(freeBoth)
|
||||
hp.verify(freeBoth)
|
||||
assert hp.getUnverified(1).isEmpty()
|
||||
|
||||
hp.addUnverified(freeBoth)
|
||||
assert hp.getUnverified(1).isEmpty()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user