From cea79d1bb8f22e4c132ebbaaacac51f5893eee00 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Wed, 16 Jul 2014 10:49:28 +0200 Subject: [PATCH] Use single threaded ExecutorService for PacketListeners. Fixes SMACK-583. --- .../main/java/org/jivesoftware/smack/XMPPConnection.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java index 6f47e5d47..63e3af9c1 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java @@ -200,7 +200,12 @@ public abstract class XMPPConnection { protected XMPPInputOutputStream compressionHandler; - private final ScheduledExecutorService executorService = new ScheduledThreadPoolExecutor(2, + /** + * ExecutorService used to invoke the PacketListeners on newly arrived and parsed stanzas. It is + * important that we use a single threaded ExecutorService in order to guarantee that the + * PacketListeners are invoked in the same order the stanzas arrived. + */ + private final ScheduledExecutorService executorService = new ScheduledThreadPoolExecutor(1, new SmackExecutorThreadFactory(connectionCounterValue)); /**