[jboss-cvs] JBossAS SVN: r87260 - in projects/aop/branches/Branch_2_1/aop/src/main/java/org/jboss/aop: advice and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Apr 14 02:25:15 EDT 2009


Author: flavia.rainone at jboss.com
Date: 2009-04-14 02:25:15 -0400 (Tue, 14 Apr 2009)
New Revision: 87260

Modified:
   projects/aop/branches/Branch_2_1/aop/src/main/java/org/jboss/aop/Advisor.java
   projects/aop/branches/Branch_2_1/aop/src/main/java/org/jboss/aop/advice/ClassifiedBindingAndPointcutCollection.java
   projects/aop/branches/Branch_2_1/aop/src/main/java/org/jboss/aop/util/UnmodifiableEmptyCollections.java
Log:
[JBAOP-720] Replaced the collection on the classes Advisor, ClassifiedBindingAndPointcutCollection, UnmodifiableEmptyCollections.

Modified: projects/aop/branches/Branch_2_1/aop/src/main/java/org/jboss/aop/Advisor.java
===================================================================
--- projects/aop/branches/Branch_2_1/aop/src/main/java/org/jboss/aop/Advisor.java	2009-04-14 06:17:52 UTC (rev 87259)
+++ projects/aop/branches/Branch_2_1/aop/src/main/java/org/jboss/aop/Advisor.java	2009-04-14 06:25:15 UTC (rev 87260)
@@ -1208,7 +1208,7 @@
       Set<Joinpoint> joinpoints = perInstanceJoinpointAspectDefinitions.get(def);
       if (joinpoints == null)
       {
-         joinpoints = new CopyOnWriteArraySet<Joinpoint>();
+         joinpoints = new ConcurrentSet<Joinpoint>();
          initPerInstanceJoinpointAspectDefinitionsMap();
          perInstanceJoinpointAspectDefinitions.put(def, joinpoints);
          def.registerAdvisor(this);
@@ -1222,7 +1222,7 @@
       Set<Joinpoint> setJoinpoints = perInstanceJoinpointAspectDefinitions.get(def);
       if (setJoinpoints == null)
       {
-         setJoinpoints = new CopyOnWriteArraySet<Joinpoint>();
+         setJoinpoints = new ConcurrentSet<Joinpoint>();
          perInstanceJoinpointAspectDefinitions.put(def, setJoinpoints);
          def.registerAdvisor(this);
       }
@@ -1427,7 +1427,7 @@
       ClassifiedBindingAndPointcutCollection bindingCol = manager.getBindingCollection();
       if(constructorInfos != null && constructorInfos.length > 0)
       {
-         for (int i = 0; i < constructors.length; i++)
+         for (int i = 0; i < constructorInfos.length; i++)
          {
             constructorInfos[i].resetInterceptors();
             Constructor<?> constructor = constructors[i];

Modified: projects/aop/branches/Branch_2_1/aop/src/main/java/org/jboss/aop/advice/ClassifiedBindingAndPointcutCollection.java
===================================================================
--- projects/aop/branches/Branch_2_1/aop/src/main/java/org/jboss/aop/advice/ClassifiedBindingAndPointcutCollection.java	2009-04-14 06:17:52 UTC (rev 87259)
+++ projects/aop/branches/Branch_2_1/aop/src/main/java/org/jboss/aop/advice/ClassifiedBindingAndPointcutCollection.java	2009-04-14 06:25:15 UTC (rev 87260)
@@ -25,7 +25,6 @@
 import java.util.Collection;
 import java.util.LinkedHashMap;
 import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.CopyOnWriteArraySet;
 
 import org.jboss.aop.AspectManager;
 import org.jboss.aop.pointcut.Pointcut;
@@ -36,6 +35,7 @@
 import org.jboss.aop.util.UnmodifiableEmptyCollections;
 import org.jboss.aop.util.UnmodifiableLinkedHashMap;
 import org.jboss.aop.util.logging.AOPLogger;
+import org.jboss.util.collection.ConcurrentSet;
 
 /**
  * Manages the binding, pointcut and pointcutInfo collections contained in a domain. All entries
@@ -633,7 +633,7 @@
       {
          if (fieldReadBindings == UnmodifiableEmptyCollections.EMPTY_ARRAYLIST)
          {
-            fieldReadBindings = new CopyOnWriteArraySet<AdviceBinding>();
+            fieldReadBindings = new ConcurrentSet<AdviceBinding>();
          }
          this.fieldReadBindings.add(binding);
          this.addFieldReadPointcut(pointcutInfo.getPointcut(), pointcutInfo);
@@ -646,7 +646,7 @@
       {
          if (fieldWriteBindings == UnmodifiableEmptyCollections.EMPTY_ARRAYLIST)
          {
-            fieldWriteBindings = new CopyOnWriteArraySet<AdviceBinding>();
+            fieldWriteBindings = new ConcurrentSet<AdviceBinding>();
          }
          this.fieldWriteBindings.add(binding);
          this.addFieldWritePointcut(pointcutInfo.getPointcut(), pointcutInfo);
@@ -659,7 +659,7 @@
       {
          if (constructionBindings == UnmodifiableEmptyCollections.EMPTY_ARRAYLIST)
          {
-            constructionBindings = new CopyOnWriteArraySet<AdviceBinding>();
+            constructionBindings = new ConcurrentSet<AdviceBinding>();
          }
          this.constructionBindings.add(binding);
          this.addConstructionPointcut(pointcutInfo.getPointcut(), pointcutInfo);
@@ -672,7 +672,7 @@
       {
          if (constructorExecutionBindings == UnmodifiableEmptyCollections.EMPTY_ARRAYLIST)
          {
-            constructorExecutionBindings = new CopyOnWriteArraySet<AdviceBinding>();
+            constructorExecutionBindings = new ConcurrentSet<AdviceBinding>();
          }
          this.constructorExecutionBindings.add(binding);
          this.addConstructorExecutionPointcut(pointcutInfo.getPointcut(), pointcutInfo);
@@ -685,7 +685,7 @@
       {
          if (methodExecutionBindings == UnmodifiableEmptyCollections.EMPTY_ARRAYLIST)
          {
-            methodExecutionBindings = new CopyOnWriteArraySet<AdviceBinding>();
+            methodExecutionBindings = new ConcurrentSet<AdviceBinding>();
          }
          this.methodExecutionBindings.add(binding);
          this.addMethodExecutionPointcut(pointcutInfo.getPointcut(), pointcutInfo);
@@ -698,7 +698,7 @@
       {
          if (methodCallBindings == UnmodifiableEmptyCollections.EMPTY_ARRAYLIST)
          {
-            methodCallBindings = new CopyOnWriteArraySet<AdviceBinding>();
+            methodCallBindings = new ConcurrentSet<AdviceBinding>();
          }
          this.methodCallBindings.add(binding);
          this.addMethodCallPointcut(pointcutInfo.getPointcut(), pointcutInfo);
@@ -711,7 +711,7 @@
       {
          if (constructorCallBindings == UnmodifiableEmptyCollections.EMPTY_ARRAYLIST)
          {
-            constructorCallBindings = new CopyOnWriteArraySet<AdviceBinding>();
+            constructorCallBindings = new ConcurrentSet<AdviceBinding>();
          }
          this.constructorCallBindings.add(binding);
          this.addConstructorCallPointcut(pointcutInfo.getPointcut(), pointcutInfo);

Modified: projects/aop/branches/Branch_2_1/aop/src/main/java/org/jboss/aop/util/UnmodifiableEmptyCollections.java
===================================================================
--- projects/aop/branches/Branch_2_1/aop/src/main/java/org/jboss/aop/util/UnmodifiableEmptyCollections.java	2009-04-14 06:17:52 UTC (rev 87259)
+++ projects/aop/branches/Branch_2_1/aop/src/main/java/org/jboss/aop/util/UnmodifiableEmptyCollections.java	2009-04-14 06:25:15 UTC (rev 87260)
@@ -1,195 +1,194 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file in the
-* distribution for a full listing of individual contributors. 
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/ 
-package org.jboss.aop.util;
-
-import gnu.trove.TLongObjectHashMap;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.WeakHashMap;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArraySet;
-
-import org.jboss.util.collection.ConcurrentSet;
-import org.jboss.util.collection.WeakValueHashMap;
-
-
-/**
- * Implementation of different types of maps, lists etc. that do not support modification.
- * Collections.unmodifiableMap() returns an instanceof Collections$UnmodifiableMap
- * which can only be cast to the Map interface and the same goes for lists
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class UnmodifiableEmptyCollections
-{
-   @SuppressWarnings("unchecked") public static final LinkedHashMap EMPTY_LINKED_HASHMAP = new LockedLinkedHashMap();
-   @SuppressWarnings("unchecked") public static final HashMap EMPTY_HASHMAP = new LockedHashMap();
-   @SuppressWarnings("unchecked") public static final WeakHashMap EMPTY_WEAK_HASHMAP = new LockedWeakHashMap();
-   @SuppressWarnings("unchecked") public static final WeakValueHashMap EMPTY_WEAK_VALUE_HASHMAP = new LockedWeakValueHashMap();
-   @SuppressWarnings("unchecked") public static final ArrayList EMPTY_ARRAYLIST = new LockedArrayList();
-   @SuppressWarnings("unchecked") public static final CopyOnWriteArraySet EMPTY_COPYONWRITE_ARRAYSET = new LockedCopyOnWriteArraySet();
-   public static final TLongObjectHashMap EMPTY_TLONG_OBJECT_HASHMAP = new LockedTLongObjectHashMap();
-   @SuppressWarnings("unchecked") public static final ConcurrentHashMap EMPTY_CONCURRENT_HASHMAP = new LockedConcurrentHashMap();
-   @SuppressWarnings("unchecked") public static final ConcurrentSet EMPTY_CONCURRENT_SET = new ConcurrentSet();
-
-   private static class LockedHashMap<K,V> extends HashMap<K,V>
-   {
-      private static final long serialVersionUID = 1L;
-
-      @Override
-      public V put(K key, V value) 
-      {
-         throw new UnsupportedOperationException();
-      }
-      @Override
-      public void putAll(Map<? extends K, ? extends V> t) 
-      {
-         throw new UnsupportedOperationException();
-      }
-   }
-
-   private static class LockedLinkedHashMap<K,V> extends LinkedHashMap<K,V>
-   {
-      private static final long serialVersionUID = 1L;
-
-      @Override
-      public V put(K key, V value) 
-      {
-         throw new UnsupportedOperationException();
-      }
-      @Override
-      public void putAll(Map<? extends K, ? extends V> t) 
-      {
-         throw new UnsupportedOperationException();
-      }
-   }
-
-   private static class LockedWeakHashMap<K,V> extends WeakHashMap<K,V>
-   {
-      private static final long serialVersionUID = 1L;
-      @Override
-      public V put(K key, V value) 
-      {
-         throw new UnsupportedOperationException();
-      }
-      @Override
-      public void putAll(Map<? extends K, ? extends V> t) 
-      {
-         throw new UnsupportedOperationException();
-      }
-   }
-   
-   
-   private static class LockedWeakValueHashMap<K, V> extends WeakValueHashMap<K, V>
-   {
-      private static final long serialVersionUID = 1L;
-      @Override
-      public V put(K key, V value) 
-      {
-         throw new UnsupportedOperationException();
-      }
-      @Override
-      public void putAll(Map<? extends K, ? extends V> t) 
-      {
-         throw new UnsupportedOperationException();
-      }
-   }
-   
-   private static class LockedArrayList<E> extends ArrayList<E>
-   {
-      private static final long serialVersionUID = 1L;
-      
-      @Override
-      public E set(int index, E element) 
-      {
-         throw new UnsupportedOperationException();
-      }
-      @Override
-      public void add(int index, E element) 
-      {
-         throw new UnsupportedOperationException();
-      }
-      @Override
-      public boolean addAll(int index, Collection<? extends E> c) 
-      {
-         throw new UnsupportedOperationException();
-      }
-      @Override
-      public boolean add(E o)
-      {
-         throw new UnsupportedOperationException();
-      }
-      @Override
-      public boolean addAll(Collection<? extends E> c)
-      {
-         throw new UnsupportedOperationException();
-      }
-   }
-   
-   private static class LockedCopyOnWriteArraySet<E> extends CopyOnWriteArraySet<E>
-   {
-      private static final long serialVersionUID = 1L;
-
-      @Override
-      public boolean add(E arg0)
-      {
-         throw new UnsupportedOperationException();
-      }
-      @Override
-      public boolean addAll(Collection<? extends E> arg0)
-      {
-         throw new UnsupportedOperationException();
-      }
-   }
-   
-   private static class LockedTLongObjectHashMap extends TLongObjectHashMap
-   {
-      private static final long serialVersionUID = 1L;
-      @Override
-      public Object put(long arg0, Object arg1)
-      {
-         throw new UnsupportedOperationException();
-      }
-   }
-   
-   private static class LockedConcurrentHashMap<K, V> extends ConcurrentHashMap<K, V>
-   {
-      private static final long serialVersionUID = 1L;
-
-      @Override
-      public V put(K key, V value) 
-      {
-         throw new UnsupportedOperationException();
-      }
-      @Override
-      public void putAll(Map<? extends K, ? extends V> t) 
-      {
-         throw new UnsupportedOperationException();
-      }
-   }
-   
-}
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.aop.util;
+
+import gnu.trove.TLongObjectHashMap;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.WeakHashMap;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.jboss.util.collection.ConcurrentSet;
+import org.jboss.util.collection.WeakValueHashMap;
+
+
+/**
+ * Implementation of different types of maps, lists etc. that do not support modification.
+ * Collections.unmodifiableMap() returns an instanceof Collections$UnmodifiableMap
+ * which can only be cast to the Map interface and the same goes for lists
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class UnmodifiableEmptyCollections
+{
+   @SuppressWarnings("unchecked") public static final LinkedHashMap EMPTY_LINKED_HASHMAP = new LockedLinkedHashMap();
+   @SuppressWarnings("unchecked") public static final HashMap EMPTY_HASHMAP = new LockedHashMap();
+   @SuppressWarnings("unchecked") public static final WeakHashMap EMPTY_WEAK_HASHMAP = new LockedWeakHashMap();
+   @SuppressWarnings("unchecked") public static final WeakValueHashMap EMPTY_WEAK_VALUE_HASHMAP = new LockedWeakValueHashMap();
+   @SuppressWarnings("unchecked") public static final ArrayList EMPTY_ARRAYLIST = new LockedArrayList();
+   @SuppressWarnings("unchecked") public static final ConcurrentSet EMPTY_COPYONWRITE_ARRAYSET = new LockedConcurrentSet();
+   public static final TLongObjectHashMap EMPTY_TLONG_OBJECT_HASHMAP = new LockedTLongObjectHashMap();
+   @SuppressWarnings("unchecked") public static final ConcurrentHashMap EMPTY_CONCURRENT_HASHMAP = new LockedConcurrentHashMap();
+   @SuppressWarnings("unchecked") public static final ConcurrentSet EMPTY_CONCURRENT_SET = new ConcurrentSet();
+
+   private static class LockedHashMap<K,V> extends HashMap<K,V>
+   {
+      private static final long serialVersionUID = 1L;
+
+      @Override
+      public V put(K key, V value) 
+      {
+         throw new UnsupportedOperationException();
+      }
+      @Override
+      public void putAll(Map<? extends K, ? extends V> t) 
+      {
+         throw new UnsupportedOperationException();
+      }
+   }
+
+   private static class LockedLinkedHashMap<K,V> extends LinkedHashMap<K,V>
+   {
+      private static final long serialVersionUID = 1L;
+
+      @Override
+      public V put(K key, V value) 
+      {
+         throw new UnsupportedOperationException();
+      }
+      @Override
+      public void putAll(Map<? extends K, ? extends V> t) 
+      {
+         throw new UnsupportedOperationException();
+      }
+   }
+
+   private static class LockedWeakHashMap<K,V> extends WeakHashMap<K,V>
+   {
+      private static final long serialVersionUID = 1L;
+      @Override
+      public V put(K key, V value) 
+      {
+         throw new UnsupportedOperationException();
+      }
+      @Override
+      public void putAll(Map<? extends K, ? extends V> t) 
+      {
+         throw new UnsupportedOperationException();
+      }
+   }
+   
+   
+   private static class LockedWeakValueHashMap<K, V> extends WeakValueHashMap<K, V>
+   {
+      private static final long serialVersionUID = 1L;
+      @Override
+      public V put(K key, V value) 
+      {
+         throw new UnsupportedOperationException();
+      }
+      @Override
+      public void putAll(Map<? extends K, ? extends V> t) 
+      {
+         throw new UnsupportedOperationException();
+      }
+   }
+   
+   private static class LockedArrayList<E> extends ArrayList<E>
+   {
+      private static final long serialVersionUID = 1L;
+      
+      @Override
+      public E set(int index, E element) 
+      {
+         throw new UnsupportedOperationException();
+      }
+      @Override
+      public void add(int index, E element) 
+      {
+         throw new UnsupportedOperationException();
+      }
+      @Override
+      public boolean addAll(int index, Collection<? extends E> c) 
+      {
+         throw new UnsupportedOperationException();
+      }
+      @Override
+      public boolean add(E o)
+      {
+         throw new UnsupportedOperationException();
+      }
+      @Override
+      public boolean addAll(Collection<? extends E> c)
+      {
+         throw new UnsupportedOperationException();
+      }
+   }
+   
+   private static class LockedConcurrentSet<E> extends ConcurrentSet<E>
+   {
+      private static final long serialVersionUID = 1L;
+
+      @Override
+      public boolean add(E arg0)
+      {
+         throw new UnsupportedOperationException();
+      }
+      @Override
+      public boolean addAll(Collection<? extends E> arg0)
+      {
+         throw new UnsupportedOperationException();
+      }
+   }
+   
+   private static class LockedTLongObjectHashMap extends TLongObjectHashMap
+   {
+      private static final long serialVersionUID = 1L;
+      @Override
+      public Object put(long arg0, Object arg1)
+      {
+         throw new UnsupportedOperationException();
+      }
+   }
+   
+   private static class LockedConcurrentHashMap<K, V> extends ConcurrentHashMap<K, V>
+   {
+      private static final long serialVersionUID = 1L;
+
+      @Override
+      public V put(K key, V value) 
+      {
+         throw new UnsupportedOperationException();
+      }
+      @Override
+      public void putAll(Map<? extends K, ? extends V> t) 
+      {
+         throw new UnsupportedOperationException();
+      }
+   }
+   
+}




More information about the jboss-cvs-commits mailing list