Set core-pool size of single-threaded executor to zero

in AbstractXMPPConnection.
This commit is contained in:
Florian Schmaus 2018-02-23 18:22:53 +01:00
parent a4ab6245f6
commit 72a2014572
1 changed files with 5 additions and 2 deletions

View File

@ -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 <i>single</i> 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<Runnable>(),
new SmackExecutorThreadFactory(this, "Single Threaded Executor"));
/**
* The used host to establish the connection to