don't establish a connection between two client nodes

This commit is contained in:
kimchy 2011-01-24 13:34:43 +02:00
parent 9d75849362
commit 9735d3e6d7
1 changed files with 15 additions and 0 deletions

View File

@ -223,6 +223,9 @@ public class InternalClusterService extends AbstractLifecycleComponent<ClusterSe
// TODO, do this in parallel (and wait)
for (DiscoveryNode node : nodesDelta.addedNodes()) {
if (!nodeRequiresConnection(node)) {
continue;
}
try {
transportService.connectToNode(node);
} catch (Exception e) {
@ -292,6 +295,9 @@ public class InternalClusterService extends AbstractLifecycleComponent<ClusterSe
if (lifecycle.stoppedOrClosed()) {
return;
}
if (!nodeRequiresConnection(node)) {
continue;
}
if (clusterState.nodes().nodeExists(node.id())) { // we double check existence of node since connectToNode might take time...
if (!transportService.nodeConnected(node)) {
try {
@ -309,4 +315,13 @@ public class InternalClusterService extends AbstractLifecycleComponent<ClusterSe
}
}
}
private boolean nodeRequiresConnection(DiscoveryNode node) {
if (localNode().clientNode()) {
if (node.clientNode()) {
return false;
}
}
return true;
}
}