From 0a189f833e1041e589ffa9523bdbe2285a678eed Mon Sep 17 00:00:00 2001 From: Christopher Shannon Date: Fri, 24 Jul 2020 16:22:24 -0400 Subject: [PATCH] AMQ-8012 - Move synchronized block after null check --- .../apache/activemq/plugin/SubQueueSelectorCacheBroker.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/activemq-broker/src/main/java/org/apache/activemq/plugin/SubQueueSelectorCacheBroker.java b/activemq-broker/src/main/java/org/apache/activemq/plugin/SubQueueSelectorCacheBroker.java index 0e488304c4..7a0e58c72c 100644 --- a/activemq-broker/src/main/java/org/apache/activemq/plugin/SubQueueSelectorCacheBroker.java +++ b/activemq-broker/src/main/java/org/apache/activemq/plugin/SubQueueSelectorCacheBroker.java @@ -276,8 +276,8 @@ public class SubQueueSelectorCacheBroker extends BrokerFilter implements Runnabl @SuppressWarnings("unchecked") public Set getSelectorsForDestination(String destinationName) { final Set cachedSelectors = subSelectorCache.get(destinationName); - synchronized(cachedSelectors) { - if (cachedSelectors != null) { + if (cachedSelectors != null) { + synchronized(cachedSelectors) { return new HashSet<>(cachedSelectors); } }