summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/common-java/src/main/java/org/apache
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-02-02 06:53:38 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-02-02 06:53:38 +0000
commit5cd7355e62c22cd5d342082b7c89aa569ad3e6b3 (patch)
tree68186343460d643082ce0eaedaa91ebb45fd6829 /sca-java-2.x/trunk/modules/common-java/src/main/java/org/apache
parent667d3a02bc5867d349b548ac5eee5212026a2551 (diff)
Improve the matching between endpoints and listeners to pass the compliance tests
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@905532 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/common-java/src/main/java/org/apache')
-rw-r--r--sca-java-2.x/trunk/modules/common-java/src/main/java/org/apache/tuscany/sca/common/java/collection/CollectionMap.java19
1 files changed, 17 insertions, 2 deletions
diff --git a/sca-java-2.x/trunk/modules/common-java/src/main/java/org/apache/tuscany/sca/common/java/collection/CollectionMap.java b/sca-java-2.x/trunk/modules/common-java/src/main/java/org/apache/tuscany/sca/common/java/collection/CollectionMap.java
index cc3fb4676d..0db80c891d 100644
--- a/sca-java-2.x/trunk/modules/common-java/src/main/java/org/apache/tuscany/sca/common/java/collection/CollectionMap.java
+++ b/sca-java-2.x/trunk/modules/common-java/src/main/java/org/apache/tuscany/sca/common/java/collection/CollectionMap.java
@@ -48,13 +48,28 @@ public class CollectionMap<K, V> extends ConcurrentHashMap<K, Collection<V>> {
}
public boolean removeValue(K key, V value) {
+ return removeValue(key, value, false);
+ }
+
+ /**
+ * Remove an entry from the collection for a key
+ * @param key The key
+ * @param value The value in the collection
+ * @param removeEmptyEntry Indicate if the entry should be removed if the collection is empty
+ * @return
+ */
+ public boolean removeValue(K key, V value, boolean removeEmptyEntry) {
Collection<V> collection = get(key);
if (collection == null) {
return false;
}
- return collection.remove(value);
+ boolean result = collection.remove(value);
+ if(removeEmptyEntry && collection.isEmpty()) {
+ remove(key);
+ }
+ return result;
}
-
+
protected Collection<V> createCollection() {
return new ArrayList<V>();
}