From 72a201457207610ef2a5aafe0cd83e015cdde104 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Fri, 23 Feb 2018 18:22:53 +0100 Subject: [PATCH] Set core-pool size of single-threaded executor to zero in AbstractXMPPConnection. --- .../org/jivesoftware/smack/AbstractXMPPConnection.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java index fb72a4ba9..8c589db99 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java @@ -31,9 +31,11 @@ import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.CopyOnWriteArraySet; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ThreadFactory; +import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.locks.Lock; @@ -258,8 +260,9 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { * decouple incoming stanza processing from callback invocation. It is important that order of callback invocation * is the same as the order of the incoming stanzas. Therefore we use a single threaded executor service. */ - private final ExecutorService singleThreadedExecutorService = Executors.newSingleThreadExecutor(new SmackExecutorThreadFactory( - this, "Single Threaded Executor")); + private final ExecutorService singleThreadedExecutorService = new ThreadPoolExecutor(0, 1, 30L, + TimeUnit.SECONDS, new LinkedBlockingQueue(), + new SmackExecutorThreadFactory(this, "Single Threaded Executor")); /** * The used host to establish the connection to