fix(manager-api-es): Fix non-breaking race condition to initialise ES index
MODIFY
manager/api/es/src/main/java/io/apiman/manager/api/es/EsStorage.java
manager/api/es/src/main/java/io/apiman/manager/api/es/EsStorage.java
@@ -196,10 +196,12 @@ public class EsStorage implements IStorage, IStorageQuery {
}
// TODO Do we need a loop to wait for all nodes to join the cluster?
Action<JestResult> action = new IndicesExists.Builder(getIndexName()).build();
+ synchronized(EsStorage.class) {
JestResult result = esClient.execute(action);
if (!result.isSucceeded()) {
createIndex(getIndexName());
}
+ }
} catch (Exception e) {
throw new RuntimeException(e);
}

fix(manager-api-es): Fix non-breaking race condition to initialise ES index

Signed-off-by: Marc Savy <marc@rhymewithgravy.com>