Possible failure when using TransportClient (with sniffing), closes #923.

This commit is contained in:
kimchy 2011-05-11 01:59:14 +03:00
parent 8c1171a6ef
commit 176f359e8b
1 changed files with 4 additions and 2 deletions

View File

@ -36,6 +36,7 @@ import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.*; import org.elasticsearch.transport.*;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
@ -255,11 +256,12 @@ public class TransportClientNodesService extends AbstractComponent {
} }
} }
// now, make sure we are connected to all the updated nodes // now, make sure we are connected to all the updated nodes
for (DiscoveryNode node : newNodes) { for (Iterator<DiscoveryNode> it = newNodes.iterator(); it.hasNext();) {
DiscoveryNode node = it.next();
try { try {
transportService.connectToNode(node); transportService.connectToNode(node);
} catch (Exception e) { } catch (Exception e) {
newNodes.remove(node); it.remove();
logger.debug("Failed to connect to discovered node [" + node + "]", e); logger.debug("Failed to connect to discovered node [" + node + "]", e);
} }
} }