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
This commit is contained in:
rcollier 2011-12-19 15:43:52 +00:00
parent e16cb2b4cc
commit 01d444ac78
1 changed files with 3 additions and 1 deletions

View File

@ -79,8 +79,9 @@ public class FaultTolerantNegotiator extends StreamNegotiator {
connection.sendPacket(super.createInitiationAccept(initiation, getNamespaces()));
ExecutorService threadPoolExecutor = Executors.newFixedThreadPool(2);
CompletionService<InputStream> service
= new ExecutorCompletionService<InputStream>(Executors.newFixedThreadPool(2));
= new ExecutorCompletionService<InputStream>(threadPoolExecutor);
List<Future<InputStream>> futures = new ArrayList<Future<InputStream>>();
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) {