Author: pete.muir(a)jboss.org
Date: 2009-04-05 16:16:46 -0400 (Sun, 05 Apr 2009)
New Revision: 2305
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ConcurrentList.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentListHashMultiMap.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentListMultiMap.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentSetHashMultiMap.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentSetMultiMap.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ListHashMultiMap.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ListMultiMap.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/SetHashMultiMap.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/SetMultiMap.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/ActivitiesTest.java
Log:
Do a deep copy on observers
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerImpl.java 2009-04-05 20:04:15
UTC (rev 2304)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerImpl.java 2009-04-05 20:16:46
UTC (rev 2305)
@@ -188,7 +188,7 @@
beans.addAll(parentManager.getBeans());
ConcurrentSetMultiMap<Type, EventObserver<?>> registeredObservers = new
ConcurrentSetHashMultiMap<Type, EventObserver<?>>();
- registeredObservers.putAll(parentManager.getRegisteredObservers());
+ registeredObservers.deepPutAll(parentManager.getRegisteredObservers());
Namespace rootNamespace = new Namespace(parentManager.getRootNamespace());
return new ManagerImpl(
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ConcurrentList.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ConcurrentList.java 2009-04-05
20:04:15 UTC (rev 2304)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ConcurrentList.java 2009-04-05
20:16:46 UTC (rev 2305)
@@ -16,6 +16,7 @@
*/
package org.jboss.webbeans.util.collections;
+import java.util.Collection;
import java.util.concurrent.CopyOnWriteArrayList;
/**
@@ -38,5 +39,22 @@
}
private static final long serialVersionUID = -7489797765014324457L;
+
+ public ConcurrentList()
+ {
+ super();
+ }
+
+ public ConcurrentList(Collection<? extends E> collection)
+ {
+ super(collection);
+ }
+
+ public ConcurrentList(E[] array)
+ {
+ super(array);
+ }
+
+
}
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentListHashMultiMap.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentListHashMultiMap.java 2009-04-05
20:04:15 UTC (rev 2304)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentListHashMultiMap.java 2009-04-05
20:16:46 UTC (rev 2305)
@@ -16,6 +16,7 @@
*/
package org.jboss.webbeans.util.collections.multi;
+import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@@ -49,6 +50,14 @@
{
return delegate;
}
+
+ public void deepPutAll(Map<? extends K, ? extends ConcurrentList<V>> map)
+ {
+ for (Entry<? extends K, ? extends ConcurrentList<V>> entry :
map.entrySet())
+ {
+ put(entry.getKey(), new ConcurrentList<V>(entry.getValue()));
+ }
+ }
/**
* Gets the list of values for a given key
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentListMultiMap.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentListMultiMap.java 2009-04-05
20:04:15 UTC (rev 2304)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentListMultiMap.java 2009-04-05
20:16:46 UTC (rev 2305)
@@ -16,6 +16,7 @@
*/
package org.jboss.webbeans.util.collections.multi;
+import java.util.Map;
import java.util.concurrent.ConcurrentMap;
import org.jboss.webbeans.util.collections.ConcurrentList;
@@ -37,4 +38,12 @@
*/
public void put(K key, V value);
+ /**
+ * Put all the data in the map into this map, copying each multi-value, not
+ * just attaching the existing multi-value
+ *
+ * @param map the map to copy
+ */
+ public void deepPutAll(Map<? extends K, ? extends ConcurrentList<V>>
map);
+
}
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentSetHashMultiMap.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentSetHashMultiMap.java 2009-04-05
20:04:15 UTC (rev 2304)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentSetHashMultiMap.java 2009-04-05
20:16:46 UTC (rev 2305)
@@ -16,6 +16,7 @@
* limitations under the License.
*/
import java.util.Collections;
+import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@@ -44,6 +45,14 @@
{
delegate = new ConcurrentHashMap<K, Set<V>>();
}
+
+ public void deepPutAll(Map<? extends K, ? extends Set<V>> map)
+ {
+ for (Entry<? extends K, ? extends Set<V>> entry : map.entrySet())
+ {
+ put(entry.getKey(), new CopyOnWriteArraySet<V>(entry.getValue()));
+ }
+ }
@Override
protected ConcurrentMap<K, Set<V>> delegate()
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentSetMultiMap.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentSetMultiMap.java 2009-04-05
20:04:15 UTC (rev 2304)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentSetMultiMap.java 2009-04-05
20:16:46 UTC (rev 2305)
@@ -16,6 +16,7 @@
*/
package org.jboss.webbeans.util.collections.multi;
+import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentMap;
@@ -37,5 +38,13 @@
* @param value the value to add
*/
public void put(K key, V value);
+
+ /**
+ * Put all the data in the map into this map, copying each multi-value, not
+ * just attaching the existing multi-value
+ *
+ * @param map the map to copy
+ */
+ public void deepPutAll(Map<? extends K, ? extends Set<V>> map);
}
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ListHashMultiMap.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ListHashMultiMap.java 2009-04-05
20:04:15 UTC (rev 2304)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ListHashMultiMap.java 2009-04-05
20:16:46 UTC (rev 2305)
@@ -50,6 +50,14 @@
{
return delegate;
}
+
+ public void deepPutAll(Map<? extends K, ? extends List<V>> map)
+ {
+ for (Entry<? extends K, ? extends List<V>> entry : map.entrySet())
+ {
+ put(entry.getKey(), new ArrayList<V>(entry.getValue()));
+ }
+ }
/**
* Gets the list of values for a given key
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ListMultiMap.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ListMultiMap.java 2009-04-05
20:04:15 UTC (rev 2304)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ListMultiMap.java 2009-04-05
20:16:46 UTC (rev 2305)
@@ -35,4 +35,12 @@
*/
public void put(K key, V value);
+ /**
+ * Put all the data in the map into this map, copying each multi-value, not
+ * just attaching the existing multi-value
+ *
+ * @param map the map to copy
+ */
+ public void deepPutAll(Map<? extends K, ? extends List<V>> map);
+
}
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/SetHashMultiMap.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/SetHashMultiMap.java 2009-04-05
20:04:15 UTC (rev 2304)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/SetHashMultiMap.java 2009-04-05
20:16:46 UTC (rev 2305)
@@ -50,6 +50,14 @@
{
return delegate;
}
+
+ public void deepPutAll(Map<? extends K, ? extends Set<V>> map)
+ {
+ for (Entry<? extends K, ? extends Set<V>> entry : map.entrySet())
+ {
+ put(entry.getKey(), new HashSet<V>(entry.getValue()));
+ }
+ }
/**
* Gets the list of values for a given key
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/SetMultiMap.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/SetMultiMap.java 2009-04-05
20:04:15 UTC (rev 2304)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/SetMultiMap.java 2009-04-05
20:16:46 UTC (rev 2305)
@@ -37,4 +37,12 @@
*/
public void put(K key, V value);
+ /**
+ * Put all the data in the map into this map, copying each multi-value, not
+ * just attaching the existing multi-value
+ *
+ * @param map the map to copy
+ */
+ public void deepPutAll(Map<? extends K, ? extends Set<V>> map);
+
}
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/ActivitiesTest.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/ActivitiesTest.java 2009-04-05
20:04:15 UTC (rev 2304)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/ActivitiesTest.java 2009-04-05
20:16:46 UTC (rev 2305)
@@ -284,7 +284,7 @@
getCurrentManager().getInstanceByType(Field.class).get();
}
- @Test(groups="ri-broken")
+ @Test
@SpecAssertion(section="11.6", id="s")
public void testObserverBelongingToChildDoesNotFireForParentActivity()
{