From 01d444ac785acb3c245692aa21b8bdb45503efa9 Mon Sep 17 00:00:00 2001 From: rcollier Date: Mon, 19 Dec 2011 15:43:52 +0000 Subject: [PATCH] SMACK-353 Fix thread leak issue. git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/branches/smack_3_2_0@12918 b35dd754-fafc-0310-a699-88a17e54d16e --- .../smackx/filetransfer/FaultTolerantNegotiator.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/org/jivesoftware/smackx/filetransfer/FaultTolerantNegotiator.java b/source/org/jivesoftware/smackx/filetransfer/FaultTolerantNegotiator.java index 3d9c3160f..ef1860678 100644 --- a/source/org/jivesoftware/smackx/filetransfer/FaultTolerantNegotiator.java +++ b/source/org/jivesoftware/smackx/filetransfer/FaultTolerantNegotiator.java @@ -79,8 +79,9 @@ public class FaultTolerantNegotiator extends StreamNegotiator { connection.sendPacket(super.createInitiationAccept(initiation, getNamespaces())); + ExecutorService threadPoolExecutor = Executors.newFixedThreadPool(2); CompletionService service - = new ExecutorCompletionService(Executors.newFixedThreadPool(2)); + = new ExecutorCompletionService(threadPoolExecutor); List> futures = new ArrayList>(); InputStream stream = null; XMPPException exception = null; @@ -119,6 +120,7 @@ public class FaultTolerantNegotiator extends StreamNegotiator { future.cancel(true); } collector.cancel(); + threadPoolExecutor.shutdownNow(); } if (stream == null) { if (exception != null) {