myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r959996 - in /myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator: core/ core/factory/ core/metadata/ core/metadata/transformer/ core/metadata/transformer/mapper/ core/property/ core/storage/ core/v...
Date Fri, 02 Jul 2010 14:17:19 GMT
Author: gpetracek
Date: Fri Jul  2 14:17:18 2010
New Revision: 959996

URL: http://svn.apache.org/viewvc?rev=959996&view=rev
Log:
sync with branch

Added:
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/NullValueAwareConcurrentHashMap.java
Modified:
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContext.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContextInvocationOrderAwareInternals.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/AbstractNameMapperAwareFactory.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/DefaultFactoryFinder.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/MetaDataEntry.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/DefaultMetaDataTransformerFactory.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/SortedNameMapperList.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/ValidationStrategyToMetaDataTransformerSubMapperAwareNameMapper.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/DefaultPropertyInformation.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyDetails.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractStorageManager.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMappedConstraintSourceStorage.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMetaDataStorage.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultPropertyStorage.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultStorageManagerFactory.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/DefaultMessageResolverFactory.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DefaultValidationParameterFactory.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/DefaultValidationStrategyFactory.java

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContext.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContext.java?rev=959996&r1=959995&r2=959996&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContext.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContext.java Fri Jul  2 14:17:18 2010
@@ -42,6 +42,8 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.logging.Logger;
 
 /**
@@ -61,10 +63,11 @@ public class ExtValContext
 
     private ViolationSeverityInterpreter violationSeverityInterpreter;
     private FactoryFinder factoryFinder = DefaultFactoryFinder.getInstance();
-    private Map<String, RendererInterceptor> rendererInterceptors = new HashMap<String, RendererInterceptor>();
-    private List<String> deniedInterceptors = new ArrayList<String>();
+    private Map<String, RendererInterceptor> rendererInterceptors =
+            new ConcurrentHashMap<String, RendererInterceptor>();
+    private List<String> deniedInterceptors = new CopyOnWriteArrayList<String>();
     private List<ProcessedInformationRecorder> processedInformationRecorders =
-            new ArrayList<ProcessedInformationRecorder>();
+            new CopyOnWriteArrayList<ProcessedInformationRecorder>();
 
     private SkipValidationEvaluator skipValidationEvaluator;
 

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContextInvocationOrderAwareInternals.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContextInvocationOrderAwareInternals.java?rev=959996&r1=959995&r2=959996&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContextInvocationOrderAwareInternals.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContextInvocationOrderAwareInternals.java Fri Jul  2 14:17:18 2010
@@ -27,10 +27,11 @@ import org.apache.myfaces.extensions.val
 import org.apache.myfaces.extensions.validator.util.ClassUtils;
 
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Collections;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.logging.Logger;
 
 /**
@@ -68,7 +69,7 @@ class ExtValContextInvocationOrderAwareI
     List<ComponentInitializer> getComponentInitializers()
     {
         return this.contextHelper.isComponentInitializationActivated() ?
-                this.componentInitializers : new ArrayList<ComponentInitializer>();
+                this.componentInitializers : new CopyOnWriteArrayList<ComponentInitializer>();
     }
 
     /*
@@ -154,7 +155,7 @@ class ExtValContextInvocationOrderAwareI
             }
             else
             {
-                propertyValidationInterceptorList = new ArrayList<PropertyValidationInterceptor>();
+                propertyValidationInterceptorList = new CopyOnWriteArrayList<PropertyValidationInterceptor>();
                 this.moduleSpecificPropertyValidationInterceptors.put(moduleKey, propertyValidationInterceptorList);
             }
             propertyValidationInterceptorList.add(propertyValidationInterceptor);
@@ -214,7 +215,7 @@ class ExtValContextInvocationOrderAwareI
             }
             else
             {
-                metaDataExtractionInterceptorList = new ArrayList<MetaDataExtractionInterceptor>();
+                metaDataExtractionInterceptorList = new CopyOnWriteArrayList<MetaDataExtractionInterceptor>();
                 this.moduleSpecificMetaDataExtractionInterceptors.put(moduleKey, metaDataExtractionInterceptorList);
             }
             metaDataExtractionInterceptorList.add(metaDataExtractionInterceptor);
@@ -268,7 +269,7 @@ class ExtValContextInvocationOrderAwareI
             return;
         }
 
-        validationExceptionInterceptors = new ArrayList<ValidationExceptionInterceptor>();
+        validationExceptionInterceptors = new CopyOnWriteArrayList<ValidationExceptionInterceptor>();
         List<String> validationExceptionInterceptorClassNames = new ArrayList<String>();
 
         validationExceptionInterceptorClassNames
@@ -300,8 +301,10 @@ class ExtValContextInvocationOrderAwareI
             return;
         }
 
-        metaDataExtractionInterceptors = new ArrayList<MetaDataExtractionInterceptor>();
-        moduleSpecificMetaDataExtractionInterceptors = new HashMap<Class, List<MetaDataExtractionInterceptor>>();
+        metaDataExtractionInterceptors =
+                new CopyOnWriteArrayList<MetaDataExtractionInterceptor>();
+        moduleSpecificMetaDataExtractionInterceptors =
+                new ConcurrentHashMap<Class, List<MetaDataExtractionInterceptor>>();
 
         List<String> metaDataExtractionInterceptorClassNames = new ArrayList<String>();
 
@@ -332,7 +335,7 @@ class ExtValContextInvocationOrderAwareI
             return;
         }
 
-        componentInitializers = new ArrayList<ComponentInitializer>();
+        componentInitializers = new CopyOnWriteArrayList<ComponentInitializer>();
         List<String> componentInitializerClassNames = new ArrayList<String>();
         componentInitializerClassNames
                 .add(WebXmlParameter.CUSTOM_COMPONENT_INITIALIZER);
@@ -361,8 +364,10 @@ class ExtValContextInvocationOrderAwareI
             return;
         }
 
-        propertyValidationInterceptors = new ArrayList<PropertyValidationInterceptor>();
-        moduleSpecificPropertyValidationInterceptors = new HashMap<Class, List<PropertyValidationInterceptor>>();
+        propertyValidationInterceptors =
+                new CopyOnWriteArrayList<PropertyValidationInterceptor>();
+        moduleSpecificPropertyValidationInterceptors =
+                new ConcurrentHashMap<Class, List<PropertyValidationInterceptor>>();
 
         List<String> validationInterceptorClassNames = new ArrayList<String>();
 
@@ -398,13 +403,24 @@ class ExtValContextInvocationOrderAwareI
      */
     private void sortComponentInitializers()
     {
-        Collections.sort(this.componentInitializers, new InvocationOrderComparator<ComponentInitializer>());
+        List<ComponentInitializer> componentInitializersToSort =
+                new ArrayList<ComponentInitializer>(this.componentInitializers);
+
+        Collections.sort(componentInitializersToSort, new InvocationOrderComparator<ComponentInitializer>());
+
+        this.componentInitializers.clear();
+        this.componentInitializers.addAll(componentInitializersToSort);
     }
 
     private void sortPropertyValidationInterceptors()
     {
-        Collections.sort(this.propertyValidationInterceptors,
+        List<PropertyValidationInterceptor> propertyValidationInterceptorsToSort =
+                new ArrayList<PropertyValidationInterceptor>(this.propertyValidationInterceptors);
+        Collections.sort(propertyValidationInterceptorsToSort,
                 new InvocationOrderComparator<PropertyValidationInterceptor>());
+
+        this.propertyValidationInterceptors.clear();
+        this.propertyValidationInterceptors.addAll(propertyValidationInterceptorsToSort);
     }
 
     //sort all - it isn't a huge overhead since it's just done during the init-phase
@@ -420,22 +436,39 @@ class ExtValContextInvocationOrderAwareI
     private List<PropertyValidationInterceptor> sortPropertyValidationInterceptorList(
             List<PropertyValidationInterceptor> propertyValidationInterceptorList)
     {
-        Collections.sort(propertyValidationInterceptorList,
+        List<PropertyValidationInterceptor> propertyValidationInterceptorListToSort =
+                new ArrayList<PropertyValidationInterceptor>(propertyValidationInterceptorList);
+
+        Collections.sort(propertyValidationInterceptorListToSort,
                     new InvocationOrderComparator<PropertyValidationInterceptor>());
 
+        propertyValidationInterceptorList.clear();
+        propertyValidationInterceptorList.addAll(propertyValidationInterceptorListToSort);
         return propertyValidationInterceptorList;
     }
 
     private void sortValidationExceptionInterceptors()
     {
-        Collections.sort(this.validationExceptionInterceptors,
+        List<ValidationExceptionInterceptor> validationExceptionInterceptorsToSort =
+                new ArrayList<ValidationExceptionInterceptor>(this.validationExceptionInterceptors);
+
+        Collections.sort(validationExceptionInterceptorsToSort,
                 new InvocationOrderComparator<ValidationExceptionInterceptor>());
+
+        this.validationExceptionInterceptors.clear();
+        this.validationExceptionInterceptors.addAll(validationExceptionInterceptorsToSort);
     }
 
     private void sortMetaDataExtractionInterceptors()
     {
-        Collections.sort(this.metaDataExtractionInterceptors,
+        List<MetaDataExtractionInterceptor> metaDataExtractionInterceptorsToSort =
+                new ArrayList<MetaDataExtractionInterceptor>(this.metaDataExtractionInterceptors);
+
+        Collections.sort(metaDataExtractionInterceptorsToSort,
                 new InvocationOrderComparator<MetaDataExtractionInterceptor>());
+
+        this.metaDataExtractionInterceptors.clear();
+        this.metaDataExtractionInterceptors.addAll(metaDataExtractionInterceptorsToSort);
     }
 
     //sort all - it isn't a huge overhead since it's just done during the init-phase
@@ -451,9 +484,14 @@ class ExtValContextInvocationOrderAwareI
     private List<MetaDataExtractionInterceptor> sortMetaDataExtractionInterceptorList(
             List<MetaDataExtractionInterceptor> metaDataExtractionInterceptorList)
     {
-        Collections.sort(metaDataExtractionInterceptorList,
+        List<MetaDataExtractionInterceptor> metaDataExtractionInterceptorListToSort =
+                new ArrayList<MetaDataExtractionInterceptor>(metaDataExtractionInterceptorList);
+
+        Collections.sort(metaDataExtractionInterceptorListToSort,
                     new InvocationOrderComparator<MetaDataExtractionInterceptor>());
 
+        metaDataExtractionInterceptorList.clear();
+        metaDataExtractionInterceptorList.addAll(metaDataExtractionInterceptorListToSort);
         return metaDataExtractionInterceptorList;
     }
 }
\ No newline at end of file

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/AbstractNameMapperAwareFactory.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/AbstractNameMapperAwareFactory.java?rev=959996&r1=959995&r2=959996&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/AbstractNameMapperAwareFactory.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/AbstractNameMapperAwareFactory.java Fri Jul  2 14:17:18 2010
@@ -26,6 +26,7 @@ import org.apache.myfaces.extensions.val
 import java.util.Iterator;
 import java.util.List;
 import java.util.ArrayList;
+import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.Collections;
 import java.util.Comparator;
 
@@ -36,14 +37,26 @@ import java.util.Comparator;
 @UsageInformation(UsageCategory.API)
 public abstract class AbstractNameMapperAwareFactory<T> implements NameMapperAwareFactory<NameMapper<T>>
 {
-    private List<Class> deniedNameMapperList = new ArrayList<Class>();
+    private List<Class> deniedNameMapperList = new CopyOnWriteArrayList<Class>();
 
     public synchronized void register(NameMapper<T> nameMapper)
     {
         if(!deniedNameMapperList.contains(nameMapper.getClass()))
         {
             getNameMapperList().add(nameMapper);
-            Collections.sort(getNameMapperList(), getComparator());
+            List<NameMapper<T>> nameMapperList = getNameMapperList();
+
+            if(nameMapperList instanceof CopyOnWriteArrayList)
+            {
+                List<NameMapper<T>> sortableList = new ArrayList<NameMapper<T>>(nameMapperList);
+                Collections.sort(sortableList, getComparator());
+                nameMapperList.clear();
+                nameMapperList.addAll(sortableList);
+            }
+            else
+            {
+                Collections.sort(nameMapperList, getComparator());
+            }
         }
     }
 

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/DefaultFactoryFinder.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/DefaultFactoryFinder.java?rev=959996&r1=959995&r2=959996&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/DefaultFactoryFinder.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/DefaultFactoryFinder.java Fri Jul  2 14:17:18 2010
@@ -38,9 +38,9 @@ import org.apache.myfaces.extensions.val
 import org.apache.myfaces.extensions.validator.util.ClassUtils;
 
 import java.util.Map;
-import java.util.HashMap;
 import java.util.List;
 import java.util.ArrayList;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.logging.Logger;
 
 /**
@@ -52,7 +52,7 @@ import java.util.logging.Logger;
 public class DefaultFactoryFinder implements FactoryFinder
 {
     protected final Logger logger = Logger.getLogger(getClass().getName());
-    protected Map<FactoryNames, Object> factoryMap = new HashMap<FactoryNames, Object>();
+    protected Map<FactoryNames, Object> factoryMap = new ConcurrentHashMap<FactoryNames, Object>();
 
     private static FactoryFinder factoryFinder = new DefaultFactoryFinder();
 

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/MetaDataEntry.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/MetaDataEntry.java?rev=959996&r1=959995&r2=959996&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/MetaDataEntry.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/MetaDataEntry.java Fri Jul  2 14:17:18 2010
@@ -90,4 +90,55 @@ public class MetaDataEntry
 
         this.properties.put(key, value);
     }
+
+    @Override
+    public boolean equals(Object o)
+    {
+        if (this == o)
+        {
+            return true;
+        }
+        if (!(o instanceof MetaDataEntry))
+        {
+            return false;
+        }
+
+        MetaDataEntry that = (MetaDataEntry) o;
+
+        if (key != null ? !key.equals(that.key) : that.key != null)
+        {
+            return false;
+        }
+        if (properties != null ? !properties.equals(that.properties) : that.properties != null)
+        {
+            return false;
+        }
+        if (value != null ? !value.equals(that.value) : that.value != null)
+        {
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public int hashCode()
+    {
+        int result = key != null ? key.hashCode() : 0;
+        result = 31 * result + (value != null ? createNullAwareHashCode(value) : 0);
+        result = 31 * result + (properties != null ? createNullAwareHashCode(properties) : 0);
+        return result;
+    }
+
+    private int createNullAwareHashCode(Object o)
+    {
+        try
+        {
+            return o.hashCode();
+        }
+        catch (NullPointerException e)
+        {
+            return 0;
+        }
+    }
 }

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/DefaultMetaDataTransformerFactory.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/DefaultMetaDataTransformerFactory.java?rev=959996&r1=959995&r2=959996&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/DefaultMetaDataTransformerFactory.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/DefaultMetaDataTransformerFactory.java Fri Jul  2 14:17:18 2010
@@ -34,13 +34,13 @@ import org.apache.myfaces.extensions.val
         ValidationStrategyToMetaDataTransformerSubMapperAwareNameMapper;
 import org.apache.myfaces.extensions.validator.util.ClassUtils;
 import org.apache.myfaces.extensions.validator.util.ProxyUtils;
+import org.apache.myfaces.extensions.validator.util.NullValueAwareConcurrentHashMap;
 import org.apache.myfaces.extensions.validator.internal.UsageInformation;
 import org.apache.myfaces.extensions.validator.internal.UsageCategory;
 
-import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.logging.Logger;
 
 
@@ -61,9 +61,10 @@ public class DefaultMetaDataTransformerF
     protected final Logger logger = Logger.getLogger(getClass().getName());
 
     private Map<String, String> validationStrategyToMetaDataTransformerMapping;
-    private List<NameMapper<ValidationStrategy>> nameMapperList = new ArrayList<NameMapper<ValidationStrategy>>();
+    private List<NameMapper<ValidationStrategy>> nameMapperList =
+            new CopyOnWriteArrayList<NameMapper<ValidationStrategy>>();
     private List<NameMapper<ValidationStrategy>> subNameMapperList =
-            new ArrayList<NameMapper<ValidationStrategy>>();
+            new CopyOnWriteArrayList<NameMapper<ValidationStrategy>>();
 
     public DefaultMetaDataTransformerFactory()
     {
@@ -191,7 +192,8 @@ public class DefaultMetaDataTransformerF
 
     private synchronized void initStaticMappings()
     {
-        validationStrategyToMetaDataTransformerMapping = new HashMap<String, String>();
+        validationStrategyToMetaDataTransformerMapping =
+                new NullValueAwareConcurrentHashMap<String, String>(String.class);
 
         //setup internal static mappings
         for (StaticConfiguration<String, String> staticConfig :

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/SortedNameMapperList.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/SortedNameMapperList.java?rev=959996&r1=959995&r2=959996&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/SortedNameMapperList.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/SortedNameMapperList.java Fri Jul  2 14:17:18 2010
@@ -25,11 +25,13 @@ import org.apache.myfaces.extensions.val
 import org.apache.myfaces.extensions.validator.internal.UsageInformation;
 
 import java.util.List;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Collection;
 import java.util.Comparator;
 import java.util.Iterator;
 import java.util.ListIterator;
+import java.util.concurrent.CopyOnWriteArrayList;
 
 
 /**
@@ -37,8 +39,10 @@ import java.util.ListIterator;
  * @since x.x.3
  */
 @UsageInformation({UsageCategory.INTERNAL})
-class SortedNameMapperList<T extends NameMapper> implements List<T>
+class SortedNameMapperList<T extends NameMapper> extends CopyOnWriteArrayList<T>
 {
+    private static final long serialVersionUID = 1502156999599962365L;
+
     private List<T> wrapped;
     private List<T> globalSubNameMapperList;
 
@@ -58,19 +62,27 @@ class SortedNameMapperList<T extends Nam
         {
             boolean result = wrapped.add(t);
 
-            Collections.sort(wrapped, new Comparator<T>()
+            sortWrappedList();
+            return result;
+        }
+    }
+
+    private void sortWrappedList()
+    {
+        List<T> sortableList = new ArrayList<T>(wrapped);
+        Collections.sort(sortableList, new Comparator<T>()
+        {
+            public int compare(T nm1, T nm2)
             {
-                public int compare(T nm1, T nm2)
+                if (nm1 instanceof SubMapperAwareNameMapper && nm2 instanceof SubMapperAwareNameMapper)
                 {
-                    if (nm1 instanceof SubMapperAwareNameMapper && nm2 instanceof SubMapperAwareNameMapper)
-                    {
-                        return 0;
-                    }
-                    return nm1 instanceof SubMapperAwareNameMapper ? 1 : -1;
+                    return 0;
                 }
-            });
-            return result;
-        }
+                return nm1 instanceof SubMapperAwareNameMapper ? 1 : -1;
+            }
+        });
+        wrapped.clear();
+        wrapped.addAll(sortableList);
     }
 
     @SuppressWarnings({"unchecked"})

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/ValidationStrategyToMetaDataTransformerSubMapperAwareNameMapper.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/ValidationStrategyToMetaDataTransformerSubMapperAwareNameMapper.java?rev=959996&r1=959995&r2=959996&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/ValidationStrategyToMetaDataTransformerSubMapperAwareNameMapper.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/ValidationStrategyToMetaDataTransformerSubMapperAwareNameMapper.java Fri Jul  2 14:17:18 2010
@@ -30,6 +30,7 @@ import org.apache.myfaces.extensions.val
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.concurrent.CopyOnWriteArrayList;
 
 /**
  * @author Gerhard Petracek
@@ -41,7 +42,8 @@ public class ValidationStrategyToMetaDat
     extends AbstractValidationStrategyToMetaDataTransformerNameMapper
     implements SubMapperAwareNameMapper<ValidationStrategy>
 {
-    private List<NameMapper<ValidationStrategy>> subNameMappers = new ArrayList<NameMapper<ValidationStrategy>>();
+    private List<NameMapper<ValidationStrategy>> subNameMappers =
+            new CopyOnWriteArrayList<NameMapper<ValidationStrategy>>();
 
     public void addNameMapper(NameMapper<ValidationStrategy> nameMapper)
     {
@@ -54,7 +56,13 @@ public class ValidationStrategyToMetaDat
 
     private void sortSubNameMappers()
     {
-        Collections.sort(this.subNameMappers, new InvocationOrderComparator<NameMapper<ValidationStrategy>>());
+        List<NameMapper<ValidationStrategy>> sortableList =
+                new ArrayList<NameMapper<ValidationStrategy>>(this.subNameMappers);
+
+        Collections.sort(sortableList, new InvocationOrderComparator<NameMapper<ValidationStrategy>>());
+
+        subNameMappers.clear();
+        subNameMappers.addAll(sortableList);
     }
 
     public String createName(ValidationStrategy source)

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/DefaultPropertyInformation.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/DefaultPropertyInformation.java?rev=959996&r1=959995&r2=959996&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/DefaultPropertyInformation.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/DefaultPropertyInformation.java Fri Jul  2 14:17:18 2010
@@ -79,4 +79,50 @@ public class DefaultPropertyInformation 
 
         this.metaDataList.clear();
     }
+
+    @Override
+    public boolean equals(Object o)
+    {
+        if (this == o)
+        {
+            return true;
+        }
+        if (!(o instanceof DefaultPropertyInformation))
+        {
+            return false;
+        }
+
+        DefaultPropertyInformation that = (DefaultPropertyInformation) o;
+
+        if (!informationMap.equals(that.informationMap))
+        {
+            return false;
+        }
+        if (!metaDataList.equals(that.metaDataList))
+        {
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public int hashCode()
+    {
+        int result = createNullAwareHashCode(informationMap);
+        result = 31 * result + createNullAwareHashCode(metaDataList);
+        return result;
+    }
+
+    private int createNullAwareHashCode(Object o)
+    {
+        try
+        {
+            return o.hashCode();
+        }
+        catch (NullPointerException e)
+        {
+            return 0;
+        }
+    }
 }

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyDetails.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyDetails.java?rev=959996&r1=959995&r2=959996&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyDetails.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyDetails.java Fri Jul  2 14:17:18 2010
@@ -65,4 +65,55 @@ public class PropertyDetails
     {
         this.property = property;
     }
+
+    @Override
+    public boolean equals(Object o)
+    {
+        if (this == o)
+        {
+            return true;
+        }
+        if (!(o instanceof PropertyDetails))
+        {
+            return false;
+        }
+
+        PropertyDetails that = (PropertyDetails) o;
+
+        if (baseObject != null ? !baseObject.equals(that.baseObject) : that.baseObject != null)
+        {
+            return false;
+        }
+        if (key != null ? !key.equals(that.key) : that.key != null)
+        {
+            return false;
+        }
+        if (property != null ? !property.equals(that.property) : that.property != null)
+        {
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public int hashCode()
+    {
+        int result = key != null ? key.hashCode() : 0;
+        result = 31 * result + (baseObject != null ? createNullAwareHashCode(baseObject) : 0);
+        result = 31 * result + (property != null ? property.hashCode() : 0);
+        return result;
+    }
+
+    private int createNullAwareHashCode(Object o)
+    {
+        try
+        {
+            return o.hashCode();
+        }
+        catch (NullPointerException e)
+        {
+            return 0;
+        }
+    }
 }

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractStorageManager.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractStorageManager.java?rev=959996&r1=959995&r2=959996&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractStorageManager.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractStorageManager.java Fri Jul  2 14:17:18 2010
@@ -26,8 +26,8 @@ import org.apache.myfaces.extensions.val
 import static org.apache.myfaces.extensions.validator.internal.UsageCategory.REUSE;
 
 import java.util.List;
-import java.util.ArrayList;
 import java.util.Map;
+import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.logging.Logger;
 
 /**
@@ -42,7 +42,7 @@ public abstract class AbstractStorageMan
 {
     protected final Logger logger = Logger.getLogger(getClass().getName());
 
-    private List<NameMapper<String>> nameMapperList = new ArrayList<NameMapper<String>>();
+    private List<NameMapper<String>> nameMapperList = new CopyOnWriteArrayList<NameMapper<String>>();
 
     public AbstractStorageManager()
     {

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMappedConstraintSourceStorage.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMappedConstraintSourceStorage.java?rev=959996&r1=959995&r2=959996&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMappedConstraintSourceStorage.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMappedConstraintSourceStorage.java Fri Jul  2 14:17:18 2010
@@ -22,10 +22,11 @@ import org.apache.myfaces.extensions.val
 import static org.apache.myfaces.extensions.validator.internal.UsageCategory.INTERNAL;
 import org.apache.myfaces.extensions.validator.internal.UsageInformation;
 import org.apache.myfaces.extensions.validator.util.ProxyUtils;
+import org.apache.myfaces.extensions.validator.util.NullValueAwareConcurrentHashMap;
 
-import java.util.HashMap;
 import java.util.Map;
 import java.util.ResourceBundle;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.logging.Logger;
 
 /**
@@ -38,7 +39,7 @@ public class DefaultMappedConstraintSour
     protected final Logger logger = Logger.getLogger(getClass().getName());
 
     private Map<String, Map<String, PropertyDetails>> propertyDetailsMap =
-            new HashMap<String, Map<String, PropertyDetails>>();
+            new ConcurrentHashMap<String, Map<String, PropertyDetails>>();
 
     public void storeMapping(Class originalClass, String originalProperty, PropertyDetails targetPropertyDetails)
     {
@@ -97,8 +98,14 @@ public class DefaultMappedConstraintSour
         String key = ProxyUtils.getClassName(target);
         if(!this.propertyDetailsMap.containsKey(key))
         {
-            this.propertyDetailsMap.put(key, new HashMap<String, PropertyDetails>());
+            this.propertyDetailsMap.put(
+                    key, new NullValueAwareConcurrentHashMap<String, PropertyDetails>(createDefaultValue()));
         }
         return this.propertyDetailsMap.get(key);
     }
+
+    private PropertyDetails createDefaultValue()
+    {
+        return new PropertyDetails(null, null, null);
+    }
 }

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMetaDataStorage.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMetaDataStorage.java?rev=959996&r1=959995&r2=959996&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMetaDataStorage.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMetaDataStorage.java Fri Jul  2 14:17:18 2010
@@ -32,11 +32,13 @@ import org.apache.myfaces.extensions.val
 import org.apache.myfaces.extensions.validator.core.ExtValContext;
 import org.apache.myfaces.extensions.validator.util.ClassUtils;
 import org.apache.myfaces.extensions.validator.util.ProxyUtils;
+import org.apache.myfaces.extensions.validator.util.NullValueAwareConcurrentHashMap;
 
 import java.util.Map;
-import java.util.HashMap;
 import java.util.List;
 import java.util.ArrayList;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.logging.Logger;
 
 /**
@@ -49,11 +51,11 @@ public class DefaultMetaDataStorage impl
     protected final Logger logger = Logger.getLogger(getClass().getName());
 
     private Map<String, Map<String, PropertyInformation>> cachedPropertyInformation =
-            new HashMap<String, Map<String, PropertyInformation>>();
+            new ConcurrentHashMap<String, Map<String, PropertyInformation>>();
 
-    private List<MetaDataStorageFilter> metaDataStorageFilters = new ArrayList<MetaDataStorageFilter>();
+    private List<MetaDataStorageFilter> metaDataStorageFilters = new CopyOnWriteArrayList<MetaDataStorageFilter>();
     private List<Class<? extends MetaDataStorageFilter>> deniedMetaDataFilters =
-            new ArrayList<Class<? extends MetaDataStorageFilter>>();
+            new CopyOnWriteArrayList<Class<? extends MetaDataStorageFilter>>();
 
     public DefaultMetaDataStorage()
     {
@@ -210,11 +212,62 @@ public class DefaultMetaDataStorage impl
         String key = ProxyUtils.getClassName(target);
         if(!this.cachedPropertyInformation.containsKey(key))
         {
-            this.cachedPropertyInformation.put(key, new HashMap<String, PropertyInformation>());
+            this.cachedPropertyInformation.put(key,
+                new NullValueAwareConcurrentHashMap<String, PropertyInformation>(new NullMarkerPropertyInformation()));
         }
         return this.cachedPropertyInformation.get(key);
     }
 
+    private static class NullMarkerPropertyInformation implements PropertyInformation
+    {
+        public boolean containsInformation(String key)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        public Object getInformation(String key)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        public <T> T getInformation(String key, Class<T> targetClass)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        public void setInformation(String key, Object value)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        public MetaDataEntry[] getMetaDataEntries()
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        public void addMetaDataEntry(MetaDataEntry metaDataEntry)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        public void resetMetaDataEntries()
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public int hashCode()
+        {
+            return getClass().hashCode();
+        }
+
+        @Override
+        public boolean equals(Object target)
+        {
+            return getClass().equals(target.getClass());
+        }
+    }
+
     private Class<? extends MetaDataStorageFilter> getStorageFilterClass(MetaDataStorageFilter storageFilter)
     {
         return ProxyUtils.getUnproxiedClass(storageFilter.getClass(), MetaDataStorageFilter.class);

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultPropertyStorage.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultPropertyStorage.java?rev=959996&r1=959995&r2=959996&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultPropertyStorage.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultPropertyStorage.java Fri Jul  2 14:17:18 2010
@@ -24,8 +24,10 @@ import org.apache.myfaces.extensions.val
 
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
-import java.util.HashMap;
 import java.util.Map;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.logging.Logger;
 
 /**
@@ -37,37 +39,77 @@ public class DefaultPropertyStorage impl
 {
     protected final Logger logger = Logger.getLogger(getClass().getName());
 
-    private Map<String, Map<String, Field>> fieldMap = new HashMap<String, Map<String, Field>>();
-    private Map<String, Map<String, Method>> methodMap = new HashMap<String, Map<String, Method>>();
+    private Map<String, Map<String, Field>> fieldMap = new ConcurrentHashMap<String, Map<String, Field>>();
+    private Map<String, Map<String, Method>> methodMap = new ConcurrentHashMap<String, Map<String, Method>>();
+    private Map<String, List<String>> fieldNotAvailableMap = new ConcurrentHashMap<String, List<String>>();
+    private Map<String, List<String>> methodNotAvailableMap = new ConcurrentHashMap<String, List<String>>();
 
     public void storeField(Class targetClass, String property, Field field)
     {
-        getFieldMapForClass(targetClass).put(property, field);
+        if(field != null)
+        {
+            getFieldMapForClass(targetClass).put(property, field);
+        }
+        else
+        {
+            getNotAvailableFieldListForClass(targetClass).add(property);
+        }
     }
 
     public void storeMethod(Class targetClass, String property, Method method)
     {
-        getMethodMapForClass(targetClass).put(property,  method);
+        if(method != null)
+        {
+            getMethodMapForClass(targetClass).put(property,  method);
+        }
+        else
+        {
+            getNotAvailableMethodListForClass(targetClass).add(property);
+        }
     }
 
     public Field getField(Class targetClass, String property)
     {
-        return getFieldMapForClass(targetClass).get(property);
+        Map<String, Field> fieldMap = getFieldMapForClass(targetClass);
+
+        if(fieldMap == null)
+        {
+            return null;
+        }
+        return fieldMap.get(property);
     }
 
     public Method getMethod(Class targetClass, String property)
     {
-        return getMethodMapForClass(targetClass).get(property);
+        Map<String, Method> methodMap = getMethodMapForClass(targetClass);
+
+        if(methodMap == null)
+        {
+            return null;
+        }
+        return methodMap.get(property);
     }
 
     public boolean containsField(Class targetClass, String property)
     {
-        return getFieldMapForClass(targetClass).containsKey(property);
+        boolean result = getFieldMapForClass(targetClass).containsKey(property);
+
+        if(!result)
+        {
+            result = getNotAvailableFieldListForClass(targetClass).contains(property);
+        }
+        return result;
     }
 
     public boolean containsMethod(Class targetClass, String property)
     {
-        return getMethodMapForClass(targetClass).containsKey(property);
+        boolean result = getMethodMapForClass(targetClass).containsKey(property);
+
+        if(!result)
+        {
+            result = getNotAvailableMethodListForClass(targetClass).contains(property);
+        }
+        return result;
     }
 
     private Map<String, Field> getFieldMapForClass(Class target)
@@ -75,18 +117,38 @@ public class DefaultPropertyStorage impl
         String key = ProxyUtils.getClassName(target);
         if (!this.fieldMap.containsKey(key))
         {
-            this.fieldMap.put(key, new HashMap<String, Field>());
+            this.fieldMap.put(key, new ConcurrentHashMap<String, Field>());
         }
         return this.fieldMap.get(key);
     }
 
+    private List<String> getNotAvailableFieldListForClass(Class target)
+    {
+        String key = ProxyUtils.getClassName(target);
+        if (!this.fieldNotAvailableMap.containsKey(key))
+        {
+            this.fieldNotAvailableMap.put(key, new CopyOnWriteArrayList<String>());
+        }
+        return this.fieldNotAvailableMap.get(key);
+    }
+
     private Map<String, Method> getMethodMapForClass(Class target)
     {
         String key = ProxyUtils.getClassName(target);
         if (!this.methodMap.containsKey(key))
         {
-            this.methodMap.put(key, new HashMap<String, Method>());
+            this.methodMap.put(key, new ConcurrentHashMap<String, Method>());
         }
         return this.methodMap.get(key);
     }
+
+    private List<String> getNotAvailableMethodListForClass(Class target)
+    {
+        String key = ProxyUtils.getClassName(target);
+        if (!this.methodNotAvailableMap.containsKey(key))
+        {
+            this.methodNotAvailableMap.put(key, new CopyOnWriteArrayList<String>());
+        }
+        return this.methodNotAvailableMap.get(key);
+    }
 }

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultStorageManagerFactory.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultStorageManagerFactory.java?rev=959996&r1=959995&r2=959996&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultStorageManagerFactory.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultStorageManagerFactory.java Fri Jul  2 14:17:18 2010
@@ -30,9 +30,9 @@ import org.apache.myfaces.extensions.val
 import static org.apache.myfaces.extensions.validator.internal.UsageCategory.INTERNAL;
 
 import java.util.List;
-import java.util.ArrayList;
 import java.util.Map;
-import java.util.HashMap;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.logging.Logger;
 
 /**
@@ -48,8 +48,8 @@ public class DefaultStorageManagerFactor
     protected final Logger logger = Logger.getLogger(getClass().getName());
 
     private boolean lazyStaticMappingApplied = false;
-    private List<NameMapper<Class>> nameMapperList = new ArrayList<NameMapper<Class>>();
-    private Map<Class, StorageManager> storageTypeToStorageManagerMap = new HashMap<Class, StorageManager>();
+    private List<NameMapper<Class>> nameMapperList = new CopyOnWriteArrayList<NameMapper<Class>>();
+    private Map<Class, StorageManager> storageTypeToStorageManagerMap = new ConcurrentHashMap<Class, StorageManager>();
 
     public DefaultStorageManagerFactory()
     {

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/DefaultMessageResolverFactory.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/DefaultMessageResolverFactory.java?rev=959996&r1=959995&r2=959996&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/DefaultMessageResolverFactory.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/DefaultMessageResolverFactory.java Fri Jul  2 14:17:18 2010
@@ -28,15 +28,15 @@ import org.apache.myfaces.extensions.val
 import org.apache.myfaces.extensions.validator.core.ExtValContext;
 import org.apache.myfaces.extensions.validator.util.ClassUtils;
 import org.apache.myfaces.extensions.validator.util.ProxyUtils;
+import org.apache.myfaces.extensions.validator.util.NullValueAwareConcurrentHashMap;
 import org.apache.myfaces.extensions.validator.internal.ToDo;
 import org.apache.myfaces.extensions.validator.internal.Priority;
 import org.apache.myfaces.extensions.validator.internal.UsageInformation;
 import org.apache.myfaces.extensions.validator.internal.UsageCategory;
 
-import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.logging.Logger;
 
 /**
@@ -53,7 +53,8 @@ public class DefaultMessageResolverFacto
     protected final Logger logger = Logger.getLogger(getClass().getName());
 
     private Map<String, String> strategyMessageResolverMapping;
-    private List<NameMapper<ValidationStrategy>> nameMapperList = new ArrayList<NameMapper<ValidationStrategy>>();
+    private List<NameMapper<ValidationStrategy>> nameMapperList =
+            new CopyOnWriteArrayList<NameMapper<ValidationStrategy>>();
 
     public DefaultMessageResolverFactory()
     {
@@ -106,7 +107,7 @@ public class DefaultMessageResolverFacto
 
     private synchronized void initStaticMappings()
     {
-        strategyMessageResolverMapping = new HashMap<String, String>();
+        strategyMessageResolverMapping = new NullValueAwareConcurrentHashMap<String, String>(String.class);
 
         //setup internal static mappings
         for (StaticConfiguration<String, String> staticConfig :

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DefaultValidationParameterFactory.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DefaultValidationParameterFactory.java?rev=959996&r1=959995&r2=959996&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DefaultValidationParameterFactory.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DefaultValidationParameterFactory.java Fri Jul  2 14:17:18 2010
@@ -26,8 +26,8 @@ import org.apache.myfaces.extensions.val
 import org.apache.myfaces.extensions.validator.internal.UsageCategory;
 import org.apache.myfaces.extensions.validator.internal.UsageInformation;
 import org.apache.myfaces.extensions.validator.util.ClassUtils;
+import org.apache.myfaces.extensions.validator.util.NullValueAwareConcurrentHashMap;
 
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -40,7 +40,7 @@ import java.util.Map;
 @UsageInformation(UsageCategory.INTERNAL)
 public class DefaultValidationParameterFactory implements ClassMappingFactory<Class, Class>
 {
-    private Map<Class, Class> parameterMapping = new HashMap<Class, Class>();
+    private Map<Class, Class> parameterMapping = new NullValueAwareConcurrentHashMap<Class, Class>(Class.class);
 
     public Class create(Class source)
     {

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/DefaultValidationStrategyFactory.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/DefaultValidationStrategyFactory.java?rev=959996&r1=959995&r2=959996&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/DefaultValidationStrategyFactory.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/DefaultValidationStrategyFactory.java Fri Jul  2 14:17:18 2010
@@ -32,16 +32,16 @@ import org.apache.myfaces.extensions.val
     .AnnotationToValidationStrategyBeanNameMapper;
 import org.apache.myfaces.extensions.validator.util.ClassUtils;
 import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.myfaces.extensions.validator.util.NullValueAwareConcurrentHashMap;
 import org.apache.myfaces.extensions.validator.internal.ToDo;
 import org.apache.myfaces.extensions.validator.internal.Priority;
 import org.apache.myfaces.extensions.validator.internal.UsageInformation;
 import org.apache.myfaces.extensions.validator.internal.UsageCategory;
 
-import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.MissingResourceException;
+import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.logging.Logger;
 
 
@@ -58,7 +58,7 @@ public class DefaultValidationStrategyFa
     protected final Logger logger = Logger.getLogger(getClass().getName());
 
     private Map<String, String> metaDataKeyToValidationStrategyMapping = null;
-    private List<NameMapper<String>> nameMapperList = new ArrayList<NameMapper<String>>();
+    private List<NameMapper<String>> nameMapperList = new CopyOnWriteArrayList<NameMapper<String>>();
 
     public DefaultValidationStrategyFactory()
     {
@@ -132,7 +132,7 @@ public class DefaultValidationStrategyFa
     @ToDo(value = Priority.MEDIUM, description = "logging")
     private synchronized void initStaticMappings()
     {
-        metaDataKeyToValidationStrategyMapping = new HashMap<String, String>();
+        metaDataKeyToValidationStrategyMapping = new NullValueAwareConcurrentHashMap<String, String>(String.class);
 
         //setup internal static mappings
         for (StaticConfiguration<String, String> staticConfig :

Added: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/NullValueAwareConcurrentHashMap.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/NullValueAwareConcurrentHashMap.java?rev=959996&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/NullValueAwareConcurrentHashMap.java (added)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/NullValueAwareConcurrentHashMap.java Fri Jul  2 14:17:18 2010
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.util;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.Map;
+
+/**
+ * in some cases we have to store null values to avoid re-evaluation
+ *
+ * @author Gerhard Petracek
+ */
+public class NullValueAwareConcurrentHashMap<K, V> extends ConcurrentHashMap<K, V>
+{
+    private static final long serialVersionUID = -7294527213622879543L;
+
+    private V nullMarkerValue;
+
+    protected NullValueAwareConcurrentHashMap(int initialCapacity, float loadFactor, int concurrencyLevel)
+    {
+        super(initialCapacity, loadFactor, concurrencyLevel);
+    }
+
+    protected NullValueAwareConcurrentHashMap(int initialCapacity, float loadFactor)
+    {
+        super(initialCapacity, loadFactor);
+    }
+
+    protected NullValueAwareConcurrentHashMap(int initialCapacity)
+    {
+        super(initialCapacity);
+    }
+
+    protected NullValueAwareConcurrentHashMap(Map<? extends K, ? extends V> m)
+    {
+        super(m);
+    }
+
+    public NullValueAwareConcurrentHashMap(V nullMarkerValue)
+    {
+        this.nullMarkerValue = nullMarkerValue;
+    }
+
+    public NullValueAwareConcurrentHashMap(Class<? extends V> nullMarkerValueClass)
+    {
+        if(nullMarkerValueClass.getName().equals(Object.class.getName()))
+        {
+            //noinspection unchecked
+            nullMarkerValue = (V)new DefaultNullMarker();
+        }
+        else if(nullMarkerValueClass.getName().equals(String.class.getName()))
+        {
+            //noinspection unchecked
+            nullMarkerValue = (V)"{null}";
+        }
+        else if(nullMarkerValueClass.getName().equals(Class.class.getName()))
+        {
+            //noinspection unchecked
+            nullMarkerValue = (V)Void.class.getClass();
+        }
+        else
+        {
+            nullMarkerValue = ClassUtils.tryToInstantiateClass(nullMarkerValueClass);
+        }
+    }
+
+    @Override
+    public V put(K key, V value)
+    {
+        if(value == null)
+        {
+            return super.put(key, nullMarkerValue);
+        }
+        return super.put(key, value);
+    }
+
+    @Override
+    public V get(Object key)
+    {
+        V result = super.get(key);
+
+        if(nullMarkerValue.equals(result))
+        {
+            return null;
+        }
+
+        return result;
+    }
+
+    private class DefaultNullMarker
+    {
+    }
+}



Mime
View raw message