Browse code

BM-13628 Fix: wait for port 9300 before attempting ES reset

Thomas Cataldo authored on 09/10/2018 15:04:32
Showing 2 changed files
... ...
@@ -9,7 +9,8 @@ Require-Bundle: org.eclipse.core.runtime,
9 9
  net.bluemind.locator.client;bundle-version="1.0.0",
10 10
  net.bluemind.slf4j;bundle-version="1.0.0",
11 11
  com.google.guava,
12
- net.bluemind.elastic.client;bundle-version="6.4.1";visibility:=reexport
12
+ net.bluemind.elastic.client;bundle-version="6.4.1";visibility:=reexport,
13
+ net.bluemind.network.utils
13 14
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
14 15
 Bundle-ClassPath: .
15 16
 Export-Package: net.bluemind.lib.elasticsearch
... ...
@@ -75,6 +75,7 @@ import com.google.common.io.ByteStreams;
75 75
 import com.google.common.io.Files;
76 76
 
77 77
 import net.bluemind.locator.client.LocatorClient;
78
+import net.bluemind.network.utils.NetworkHelper;
78 79
 
79 80
 public final class ESearchActivator implements BundleActivator {
80 81
 
... ...
@@ -376,6 +377,10 @@ public final class ESearchActivator implements BundleActivator {
376 376
 	}
377 377
 
378 378
 	public static void resetIndex(String index) {
379
+		Collection<String> hosts = new LocatorClient().locateHosts("bm/es", "fake@global.virt");
380
+		for (String host : hosts) {
381
+			new NetworkHelper(host).waitForListeningPort(9300, 30, TimeUnit.SECONDS);
382
+		}
379 383
 		Client client = ESearchActivator.getClient();
380 384
 		resetIndex(client, index);
381 385
 	}