You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by cs...@apache.org on 2018/09/28 10:12:29 UTC
[aries-rsa] branch master updated: ARIES-1837 - Avoid
ConcurrentModificationException by using ConcurrentHashmap and remove
ineffective synchronized
This is an automated email from the ASF dual-hosted git repository.
cschneider pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/aries-rsa.git
The following commit(s) were added to refs/heads/master by this push:
new 39dde12 ARIES-1837 - Avoid ConcurrentModificationException by using ConcurrentHashmap and remove ineffective synchronized
39dde12 is described below
commit 39dde12bf51b7a702d298f4033efbb98e119b9e8
Author: Christian Schneider <cs...@adobe.com>
AuthorDate: Fri Sep 28 12:12:16 2018 +0200
ARIES-1837 - Avoid ConcurrentModificationException by using ConcurrentHashmap and remove ineffective synchronized
---
.../aries/rsa/discovery/zookeeper/subscribe/InterestManager.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/subscribe/InterestManager.java b/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/subscribe/InterestManager.java
index cf5d5fb..0a74d61 100644
--- a/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/subscribe/InterestManager.java
+++ b/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/subscribe/InterestManager.java
@@ -21,6 +21,7 @@ package org.apache.aries.rsa.discovery.zookeeper.subscribe;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
import org.apache.aries.rsa.discovery.zookeeper.ZooKeeperDiscovery;
import org.apache.aries.rsa.discovery.zookeeper.repository.ZookeeperEndpointRepository;
@@ -43,7 +44,7 @@ public class InterestManager implements EndpointEventListener {
private static final Logger LOG = LoggerFactory.getLogger(InterestManager.class);
private final ZookeeperEndpointRepository repository;
- private final Map<ServiceReference, Interest> interests = new HashMap<ServiceReference, Interest>();
+ private final Map<ServiceReference, Interest> interests = new ConcurrentHashMap<ServiceReference, Interest>();
protected static class Interest {
List<String> scopes;
@@ -86,7 +87,7 @@ public class InterestManager implements EndpointEventListener {
EndpointEventListener.getProperty(ZooKeeperDiscovery.DISCOVERY_ZOOKEEPER_ID)));
}
- public synchronized void removeInterest(ServiceReference<EndpointEventListener> epListenerRef) {
+ public void removeInterest(ServiceReference<EndpointEventListener> epListenerRef) {
LOG.info("removing EndpointEventListener interests: {}", epListenerRef);
interests.remove(epListenerRef);
}