Add listener nodes to nodes list if 'sniff' is true

TransportClient doesn't add the initial nodes to the nodes list
if it doesn't retrieve any nodes from the listeners which can cause
the transport client to throw a 'NoNodeAvailableException' if the
'sniff' response didn't return any nodes. This situation can occure
if the client tries to get the listener nodes cluster state while that
node is not yet connected to any other nodes.
This commit is contained in:
Simon Willnauer 2013-09-21 21:15:44 +02:00
parent 7c032f6af6
commit e1aa91dc81
1 changed files with 1 additions and 1 deletions

View File

@ -419,7 +419,7 @@ public class TransportClientNodesService extends AbstractComponent {
return;
}
HashSet<DiscoveryNode> newNodes = new HashSet<DiscoveryNode>();
HashSet<DiscoveryNode> newNodes = new HashSet<DiscoveryNode>(listedNodes);
for (ClusterStateResponse clusterStateResponse : clusterStateResponses) {
if (!ignoreClusterName && !clusterName.equals(clusterStateResponse.getClusterName())) {
logger.warn("node {} not part of the cluster {}, ignoring...", clusterStateResponse.getState().nodes().localNode(), clusterName);