tihom88 commented on code in PR #559:
URL: https://github.com/apache/jackrabbit-oak/pull/559#discussion_r865684223


##########
oak-search-elastic/src/test/java/org/apache/jackrabbit/oak/plugins/index/elastic/ElasticTestServer.java:
##########
@@ -44,23 +44,32 @@ public class ElasticTestServer implements AutoCloseable {
 
     private static final Logger LOG = 
LoggerFactory.getLogger(ElasticTestServer.class);
     private static final String PLUGIN_DIGEST = 
"db479aeee452b2a0f6e3c619ecdf27ca5853e54e7bc787e5c56a49899c249240";
-    private static ElasticTestServer esTestServer;
-    private volatile ElasticsearchContainer elasticsearchContainer;
+    private static ElasticTestServer esTestServer = new ElasticTestServer();
+    private static volatile ElasticsearchContainer elasticsearchContainer;
 
-    public static synchronized ElasticTestServer getESTestServer() {
-            if (esTestServer == null) {
-                LOG.info("Starting ES test server");
-                esTestServer = new ElasticTestServer();
-                esTestServer.setup();
-                Runtime.getRuntime().addShutdownHook(new Thread(() -> {
-                    LOG.info("Stopping global ES test server.");
-                    esTestServer.close();
-                }));
+    private ElasticTestServer() {
+    }
+
+    public static synchronized ElasticsearchContainer getESTestServer() {
+        // Setup a new ES container if elasticsearchContainer is null or not 
running
+        if (elasticsearchContainer == null || 
!elasticsearchContainer.isRunning()) {

Review Comment:
   Can a container be in different state like starting? 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to