mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-18 21:02:04 +01:00
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:
parent
e16cb2b4cc
commit
01d444ac78
1 changed files with 3 additions and 1 deletions
|
@ -79,8 +79,9 @@ public class FaultTolerantNegotiator extends StreamNegotiator {
|
||||||
|
|
||||||
connection.sendPacket(super.createInitiationAccept(initiation, getNamespaces()));
|
connection.sendPacket(super.createInitiationAccept(initiation, getNamespaces()));
|
||||||
|
|
||||||
|
ExecutorService threadPoolExecutor = Executors.newFixedThreadPool(2);
|
||||||
CompletionService<InputStream> service
|
CompletionService<InputStream> service
|
||||||
= new ExecutorCompletionService<InputStream>(Executors.newFixedThreadPool(2));
|
= new ExecutorCompletionService<InputStream>(threadPoolExecutor);
|
||||||
List<Future<InputStream>> futures = new ArrayList<Future<InputStream>>();
|
List<Future<InputStream>> futures = new ArrayList<Future<InputStream>>();
|
||||||
InputStream stream = null;
|
InputStream stream = null;
|
||||||
XMPPException exception = null;
|
XMPPException exception = null;
|
||||||
|
@ -119,6 +120,7 @@ public class FaultTolerantNegotiator extends StreamNegotiator {
|
||||||
future.cancel(true);
|
future.cancel(true);
|
||||||
}
|
}
|
||||||
collector.cancel();
|
collector.cancel();
|
||||||
|
threadPoolExecutor.shutdownNow();
|
||||||
}
|
}
|
||||||
if (stream == null) {
|
if (stream == null) {
|
||||||
if (exception != null) {
|
if (exception != null) {
|
||||||
|
|
Loading…
Reference in a new issue