From 027cae3bd0ead2849930875c790dee6755c3d382 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Mon, 3 Jun 2019 09:27:28 +0200 Subject: [PATCH] Remove unnecessary synchronization in SmackReater.schedule() The DelayQueue 'scheduledActions' is already thread-safe. --- .../src/main/java/org/jivesoftware/smack/SmackReactor.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/SmackReactor.java b/smack-core/src/main/java/org/jivesoftware/smack/SmackReactor.java index ffc622633..443785dba 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/SmackReactor.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/SmackReactor.java @@ -149,9 +149,7 @@ public class SmackReactor { long releaseTimeEpoch = System.currentTimeMillis() + unit.toMillis(delay); Date releaseTimeDate = new Date(releaseTimeEpoch); ScheduledAction scheduledAction = new ScheduledAction(runnable, releaseTimeDate, this); - synchronized (scheduledActions) { - scheduledActions.add(scheduledAction); - } + scheduledActions.add(scheduledAction); return scheduledAction; }