diff --git a/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpPipeliningHandlerTests.java b/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpPipeliningHandlerTests.java index 895c07ec7a3f6..aa6e51cf9fb00 100644 --- a/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpPipeliningHandlerTests.java +++ b/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpPipeliningHandlerTests.java @@ -70,16 +70,7 @@ public class Netty4HttpPipeliningHandlerTests extends ESTestCase { @After public void tearDown() throws Exception { waitingRequests.keySet().forEach(this::finishRequest); - shutdownExecutorService(); - super.tearDown(); - } - - private CountDownLatch finishRequest(String url) { - waitingRequests.get(url).countDown(); - return finishingRequests.get(url); - } - - private void shutdownExecutorService() throws InterruptedException { + // shutdown the Executor Service if (handlerService.isShutdown() == false) { handlerService.shutdown(); handlerService.awaitTermination(10, TimeUnit.SECONDS); @@ -88,6 +79,12 @@ private void shutdownExecutorService() throws InterruptedException { eventLoopService.shutdown(); eventLoopService.awaitTermination(10, TimeUnit.SECONDS); } + super.tearDown(); + } + + private CountDownLatch finishRequest(String url) { + waitingRequests.get(url).countDown(); + return finishingRequests.get(url); } public void testThatPipeliningWorksWithFastSerializedRequests() throws InterruptedException {