Skip to content

Commit e936efa

Browse files
zz123happyzengjun1rashtao
authored
remove close host (#347)
Co-authored-by: zengjun1 <zengjun1@staff.sina.com.cn> Co-authored-by: Michele Rastelli <rashtao@gmail.com>
1 parent 44cfdf0 commit e936efa

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Diff for: src/main/java/com/arangodb/internal/net/HostSet.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import java.io.IOException;
77
import java.util.ArrayList;
88
import java.util.Collections;
9+
import java.util.Iterator;
910
import java.util.List;
1011

1112
public class HostSet {
@@ -75,15 +76,17 @@ public void clearAllMarkedForDeletion() {
7576

7677
LOGGER.debug("Clear all Hosts in Set with markForDeletion");
7778

78-
for (Host host : hosts) {
79+
Iterator<Host> iterable = hosts.iterator();
80+
while (iterable.hasNext()){
81+
Host host = iterable.next();
7982
if (host.isMarkforDeletion()) {
8083
try {
81-
8284
LOGGER.debug("Try to close Host " + host);
8385
host.close();
84-
8586
} catch (IOException e) {
8687
LOGGER.warn("Error during closing the Host " + host, e);
88+
} finally {
89+
iterable.remove();
8790
}
8891
}
8992
}

0 commit comments

Comments
 (0)