You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 10:19:36 UTC
[sling-org-apache-sling-testing-osgi-mock] 07/12: SLING-4845 -
MockBundleContext is not thread-safe
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.testing.osgi-mock-1.5.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-osgi-mock.git
commit 9260a5825551a06d739f00ac1d4df1b9da5ee9f0
Author: Julian Sedding <js...@apache.org>
AuthorDate: Mon Jun 29 19:46:20 2015 +0000
SLING-4845 - MockBundleContext is not thread-safe
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/testing/mocks/osgi-mock@1688292 13f79535-47bb-0310-9956-ffa450edef68
---
.../java/org/apache/sling/testing/mock/osgi/MockBundleContext.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/sling/testing/mock/osgi/MockBundleContext.java b/src/main/java/org/apache/sling/testing/mock/osgi/MockBundleContext.java
index e37f8e9..0490475 100644
--- a/src/main/java/org/apache/sling/testing/mock/osgi/MockBundleContext.java
+++ b/src/main/java/org/apache/sling/testing/mock/osgi/MockBundleContext.java
@@ -23,12 +23,12 @@ import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Dictionary;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
-import java.util.concurrent.ConcurrentHashMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.felix.framework.FilterImpl;
@@ -53,6 +53,7 @@ import org.slf4j.LoggerFactory;
import com.google.common.collect.ImmutableList;
import static java.util.Collections.synchronizedList;
+import static java.util.Collections.synchronizedMap;
import static java.util.Collections.synchronizedSortedSet;
/**
@@ -64,7 +65,7 @@ class MockBundleContext implements BundleContext {
private final MockBundle bundle;
private final SortedSet<MockServiceRegistration> registeredServices = synchronizedSortedSet(new TreeSet<MockServiceRegistration>());
- private final Map<ServiceListener, Filter> serviceListeners = new ConcurrentHashMap<ServiceListener, Filter>();
+ private final Map<ServiceListener, Filter> serviceListeners = synchronizedMap(new HashMap<ServiceListener, Filter>());
private final List<BundleListener> bundleListeners = synchronizedList(new ArrayList<BundleListener>());
public MockBundleContext() {
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.