1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-22 06:12:05 +01:00

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

View file

@ -31,9 +31,11 @@ import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.CopyOnWriteArraySet; import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.Lock; 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 * 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. * 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( private final ExecutorService singleThreadedExecutorService = new ThreadPoolExecutor(0, 1, 30L,
this, "Single Threaded Executor")); TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(),
new SmackExecutorThreadFactory(this, "Single Threaded Executor"));
/** /**
* The used host to establish the connection to * The used host to establish the connection to