Skip to content

Commit e8e9610

Browse files
committed
Use Executor service
1 parent a42ded9 commit e8e9610

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/framework/src/main/java/org/elasticsearch/repositories/blobstore/ESMockAPIBasedRepositoryIntegTestCase.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
import java.net.InetSocketAddress;
4242
import java.util.Map;
4343
import java.util.concurrent.ConcurrentHashMap;
44+
import java.util.concurrent.ExecutorService;
45+
import java.util.concurrent.Executors;
46+
import java.util.concurrent.TimeUnit;
4447
import java.util.concurrent.atomic.AtomicInteger;
4548

4649
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
@@ -54,11 +57,14 @@
5457
public abstract class ESMockAPIBasedRepositoryIntegTestCase extends ESBlobStoreRepositoryIntegTestCase {
5558

5659
private static HttpServer httpServer;
60+
private static ExecutorService executorService;
5761
private Map<String, HttpHandler> handlers;
5862

5963
@BeforeClass
6064
public static void startHttpServer() throws Exception {
65+
executorService = Executors.newCachedThreadPool();
6166
httpServer = MockHttpServer.createHttp(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0), 0);
67+
httpServer.setExecutor(executorService);
6268
httpServer.start();
6369
}
6470

@@ -75,9 +81,11 @@ public void setUpHttpServer() {
7581
}
7682

7783
@AfterClass
78-
public static void stopHttpServer() {
84+
public static void stopHttpServer() throws Exception {
7985
httpServer.stop(0);
8086
httpServer = null;
87+
executorService.shutdown();
88+
assertTrue(executorService.awaitTermination(10L, TimeUnit.SECONDS));
8189
}
8290

8391
@After

0 commit comments

Comments
 (0)