From e56b18df338bf4440f44783d169e4405d9e92f82 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 15 Jul 2015 07:14:33 +0200 Subject: [PATCH] Shutdown thread pool after use --- .../java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java b/src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java index 3ea9570..35a2857 100644 --- a/src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java +++ b/src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java @@ -58,13 +58,13 @@ public class DefaultFcpClientTest { private static final String REQUEST_URI = "SSK@wtbgd2loNcJCXvtQVOftl2tuWBomDQHfqS6ytpPRhfw,7SHH53gletBVb9JD7nBsyClbLQsBubDPEIcwg908r7Y,AQACAAE/"; - private static int threadCounter = 0; + private int threadCounter = 0; + private final ExecutorService threadPool = + Executors.newCachedThreadPool(r -> new Thread(r, "Test-Thread-" + threadCounter++)); private final FakeTcpServer fcpServer; private final DefaultFcpClient fcpClient; public DefaultFcpClientTest() throws IOException { - ExecutorService threadPool = - Executors.newCachedThreadPool(r -> new Thread(r, "Test-Thread-" + threadCounter++)); fcpServer = new FakeTcpServer(threadPool); fcpClient = new DefaultFcpClient(threadPool, "localhost", fcpServer.getPort(), () -> "Test"); } @@ -72,6 +72,7 @@ public class DefaultFcpClientTest { @After public void tearDown() throws IOException { fcpServer.close(); + threadPool.shutdown(); } @Test(expected = ExecutionException.class) -- 2.7.4