]> source.dussan.org Git - archiva.git/commitdiff
make it clear it is ConcurrentMap so no need of synchronized block
authorOlivier Lamy <olamy@apache.org>
Mon, 24 Nov 2014 00:14:11 +0000 (11:14 +1100)
committerOlivier Lamy <olamy@apache.org>
Mon, 24 Nov 2014 00:14:32 +0000 (11:14 +1100)
archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java

index 11eda06f32fe735cc1c7d837ad14adca76b04631..6862149389863752e4ae7d6149ca76581ae1d942 100644 (file)
@@ -97,6 +97,7 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Properties;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
 
 /**
  * DefaultRepositoryProxyConnectors
@@ -134,9 +135,9 @@ public class DefaultRepositoryProxyConnectors
     @Inject
     private UrlFailureCache urlFailureCache;
 
-    private Map<String, List<ProxyConnector>> proxyConnectorMap = new ConcurrentHashMap<>();
+    private ConcurrentMap<String, List<ProxyConnector>> proxyConnectorMap = new ConcurrentHashMap<>();
 
-    private Map<String, ProxyInfo> networkProxyMap = new ConcurrentHashMap<>();
+    private ConcurrentMap<String, ProxyInfo> networkProxyMap = new ConcurrentHashMap<>();
 
     @Inject
     private WagonFactory wagonFactory;
@@ -1253,17 +1254,16 @@ public class DefaultRepositoryProxyConnectors
     @Override
     public List<ProxyConnector> getProxyConnectors( ManagedRepositoryContent repository )
     {
-        synchronized ( this.proxyConnectorMap )
-        {
-            List<ProxyConnector> ret = this.proxyConnectorMap.get( repository.getId() );
-            if ( ret == null )
-            {
-                return Collections.emptyList();
-            }
 
-            Collections.sort( ret, ProxyConnectorOrderComparator.getInstance() );
-            return ret;
+        List<ProxyConnector> ret = this.proxyConnectorMap.get( repository.getId() );
+        if ( ret == null )
+        {
+            return Collections.emptyList();
         }
+
+        Collections.sort( ret, ProxyConnectorOrderComparator.getInstance() );
+        return ret;
+
     }
 
     @Override