You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cs...@apache.org on 2020/07/24 20:30:11 UTC

[activemq] branch activemq-5.16.x updated: AMQ-8012 - Move synchronized block after null check

This is an automated email from the ASF dual-hosted git repository.

cshannon pushed a commit to branch activemq-5.16.x
in repository https://gitbox.apache.org/repos/asf/activemq.git


The following commit(s) were added to refs/heads/activemq-5.16.x by this push:
     new 2fa7f09  AMQ-8012 - Move synchronized block after null check
2fa7f09 is described below

commit 2fa7f09fb958e320e7c458908a5c6310ed0a6a1b
Author: Christopher L. Shannon (cshannon) <ch...@gmail.com>
AuthorDate: Fri Jul 24 16:22:24 2020 -0400

    AMQ-8012 - Move synchronized block after null check
    
    (cherry picked from commit 0a189f833e1041e589ffa9523bdbe2285a678eed)
---
 .../java/org/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 0e48830..7a0e58c 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<String> getSelectorsForDestination(String destinationName) {
         final Set<String> cachedSelectors = subSelectorCache.get(destinationName);
-        synchronized(cachedSelectors) {
-            if (cachedSelectors != null) {
+        if (cachedSelectors != null) {
+            synchronized(cachedSelectors) {
                 return new HashSet<>(cachedSelectors);
             }
         }