bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1514313 - in /bval/branches/bval-11: bval-core/src/main/java/org/apache/bval/ bval-core/src/main/java/org/apache/bval/model/ bval-jsr303/src/main/java/org/apache/bval/cdi/ bval-jsr303/src/main/java/org/apache/bval/jsr303/ bval-jsr303/src/m...
Date Thu, 15 Aug 2013 15:09:24 GMT
Author: rmannibucau
Date: Thu Aug 15 15:09:23 2013
New Revision: 1514313

URL: http://svn.apache.org/r1514313
Log:
removing some synchronized + useless locks

Modified:
    bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/MetaBeanManager.java
    bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/FeaturesCapable.java
    bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/BValExtension.java
    bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheValidatorFactory.java
    bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/BeanDescriptorImpl.java
    bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConfigurationImpl.java
    bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303MetaBeanFactory.java
    bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/groups/GroupsComputer.java
    bval/branches/bval-11/bval-xstream/src/main/java/org/apache/bval/xml/XMLFeaturesCapable.java

Modified: bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/MetaBeanManager.java
URL: http://svn.apache.org/viewvc/bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/MetaBeanManager.java?rev=1514313&r1=1514312&r2=1514313&view=diff
==============================================================================
--- bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/MetaBeanManager.java (original)
+++ bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/MetaBeanManager.java Thu
Aug 15 15:09:23 2013
@@ -19,9 +19,6 @@ package org.apache.bval;
 import org.apache.bval.model.MetaBean;
 import org.apache.bval.model.MetaProperty;
 
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
 import static org.apache.bval.model.Features.Property.REF_BEAN_ID;
 import static org.apache.bval.model.Features.Property.REF_BEAN_TYPE;
 import static org.apache.bval.model.Features.Property.REF_CASCADE;
@@ -41,8 +38,6 @@ public class MetaBeanManager implements 
     /** Complete flag */
     protected boolean complete = false;
 
-    protected final ConcurrentMap<Object, Object> cacheLocks = new ConcurrentHashMap<Object,
Object>();
-
     /**
      * Create a new MetaBeanManager instance.
      */
@@ -53,7 +48,7 @@ public class MetaBeanManager implements 
     /**
      * Create a new MetaBeanManager instance.
      * 
-     * @param builder
+     * @param builder meta bean builder
      */
     public MetaBeanManager(MetaBeanBuilder builder) {
         this.builder = builder;
@@ -86,32 +81,16 @@ public class MetaBeanManager implements 
             return beanInfo;
         }
 
-        synchronized (getLockFor(beanInfoId)) {
-            beanInfo = cache.findForId(beanInfoId);
-            if (beanInfo != null) {
-                return beanInfo;
-            }
-
-            try {
-                beanInfo = builder.buildForId(beanInfoId);
-                cache.cache(beanInfo);
-                computeRelationships(beanInfo);
-                return beanInfo;
-            } catch (final RuntimeException e) {
-                throw e; // do not wrap runtime exceptions
-            } catch (final Exception e) {
-                throw new IllegalArgumentException("error creating beanInfo with id: " +
beanInfoId, e);
-            }
-        }
-    }
-
-    private Object getLockFor(final Object key) {
-        final Object newLock = new Object();
-        Object lock = cacheLocks.putIfAbsent(key, newLock);
-        if (lock == null) {
-            lock = newLock;
+        try {
+            beanInfo = builder.buildForId(beanInfoId);
+            cache.cache(beanInfo);
+            computeRelationships(beanInfo);
+            return beanInfo;
+        } catch (final RuntimeException e) {
+            throw e; // do not wrap runtime exceptions
+        } catch (final Exception e) {
+            throw new IllegalArgumentException("error creating beanInfo with id: " + beanInfoId,
e);
         }
-        return lock;
     }
 
     /**
@@ -127,22 +106,15 @@ public class MetaBeanManager implements 
             return beanInfo;
         }
 
-        synchronized (getLockFor(clazz)) {
-            beanInfo = cache.findForClass(clazz);
-            if (beanInfo != null) {
-                return beanInfo;
-            }
-
-            try {
-                beanInfo = builder.buildForClass(clazz);
-                cache.cache(beanInfo);
-                computeRelationships(beanInfo);
-                return beanInfo;
-            } catch (final RuntimeException e) {
-                throw e; // do not wrap runtime exceptions
-            } catch (final Exception e) {
-                throw new IllegalArgumentException("error creating beanInfo for " + clazz,
e);
-            }
+        try {
+            beanInfo = builder.buildForClass(clazz);
+            cache.cache(beanInfo);
+            computeRelationships(beanInfo);
+            return beanInfo;
+        } catch (final RuntimeException e) {
+            throw e; // do not wrap runtime exceptions
+        } catch (final Exception e) {
+            throw new IllegalArgumentException("error creating beanInfo for " + clazz, e);
         }
     }
 
@@ -163,8 +135,8 @@ public class MetaBeanManager implements 
     /**
      * Compute a single related {@link MetaBean}.
      * 
-     * @param prop
-     * @param beanRef
+     * @param prop meta property
+     * @param beanRef bean reference
      */
     protected void computeRelatedMetaBean(MetaProperty prop, String beanRef) {
         Class<?> beanType = prop.getFeature(REF_BEAN_TYPE);

Modified: bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/FeaturesCapable.java
URL: http://svn.apache.org/viewvc/bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/FeaturesCapable.java?rev=1514313&r1=1514312&r2=1514313&view=diff
==============================================================================
--- bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/FeaturesCapable.java
(original)
+++ bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/FeaturesCapable.java
Thu Aug 15 15:09:23 2013
@@ -16,13 +16,12 @@
  */
 package org.apache.bval.model;
 
+import org.apache.commons.lang3.ArrayUtils;
+
 import java.io.Serializable;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.locks.ReentrantLock;
-
-import org.apache.commons.lang3.ArrayUtils;
 
 /**
  * Description: abstract superclass of meta objects that support a map of
@@ -36,9 +35,6 @@ public abstract class FeaturesCapable im
     /** key = validation id, value = the validation */
     private Validation[] validations = new Validation[0];
 
-    private volatile boolean locking;
-    private ReentrantLock lock = new ReentrantLock(true);
-
     /**
      * Create a new FeaturesCapable instance.
      */
@@ -56,21 +52,6 @@ public abstract class FeaturesCapable im
     }
 
     /**
-     * Set whether to optimize read operations by accessing the features map in
-     * an unsynchronized manner.
-     * 
-     * @param fast
-     */
-    public void optimizeRead(boolean fast) {
-        lock.lock();
-        try {
-            this.locking = !fast;
-        } finally {
-            lock.unlock();
-        }
-    }
-
-    /**
      * Get the specified feature.
      * 
      * @param <T>
@@ -92,32 +73,29 @@ public abstract class FeaturesCapable im
      */
     @SuppressWarnings("unchecked")
     public <T> T getFeature(String key, T defaultValue) {
-        boolean release = acquireLockIfNeeded();
-        try {
-            return features.containsKey(key) ? (T) features.get(key) : defaultValue;
-        } finally {
-            if (release) {
-                lock.unlock();
-            }
+        final T value = (T) features.get(key);
+        if (value == null) {
+            return defaultValue;
         }
+        return value;
     }
 
     /**
      * Convenience method to set a particular feature value.
-     * 
-     * @param <T>
+     *
      * @param key
      * @param value
      */
-    public <T> void putFeature(String key, T value) {
-        boolean release = acquireLockIfNeeded();
-        try {
-            features.put(key, value);
-        } finally {
-            if (release) {
-                lock.unlock();
-            }
+    public <T> void putFeature(final String key, final T value) {
+        features.put(key, value);
+    }
+
+    public <T> T initFeature(final String key, final T value) {
+        final T old = (T) features.putIfAbsent(key, value);
+        if (old != null) {
+            return old;
         }
+        return value;
     }
 
     /**
@@ -207,17 +185,4 @@ public abstract class FeaturesCapable im
     protected ConcurrentMap<String, Object> createFeaturesMap() {
         return new ConcurrentHashMap<String, Object>();
     }
-
-    private boolean acquireLockIfNeeded() {
-        if (locking) {
-            lock.lock();
-            // double read
-            if (locking) {
-                return true;
-            }
-            lock.unlock();
-        }
-        return false;
-    }
-
 }

Modified: bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/BValExtension.java
URL: http://svn.apache.org/viewvc/bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/BValExtension.java?rev=1514313&r1=1514312&r2=1514313&view=diff
==============================================================================
--- bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/BValExtension.java
(original)
+++ bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/BValExtension.java
Thu Aug 15 15:09:23 2013
@@ -199,15 +199,17 @@ public class BValExtension implements Ex
         final BeanManagerInfo bmi = getBeanManagerInfo(loader());
 
         BeanManager result = bmi.finalBm;
-        if (result == null) {
+        if (result == null && bmi.cdi == null) {
             synchronized (this) {
                 result = resolveBeanManagerViaJndi();
                 if (result == null) {
                     result = bmi.loadTimeBm;
                 }
                 if (result == null) {
+                    bmi.cdi = false;
                     return null;
                 }
+                bmi.cdi = true;
                 bmi.finalBm = result;
             }
         }
@@ -272,6 +274,7 @@ public class BValExtension implements Ex
     private static class BeanManagerInfo {
         private BeanManager loadTimeBm = null;
         private BeanManager finalBm = null;
+        private Boolean cdi = null;
     }
 
     public static class Releasable<T> {

Modified: bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheValidatorFactory.java
URL: http://svn.apache.org/viewvc/bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheValidatorFactory.java?rev=1514313&r1=1514312&r2=1514313&view=diff
==============================================================================
--- bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheValidatorFactory.java
(original)
+++ bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheValidatorFactory.java
Thu Aug 15 15:09:23 2013
@@ -34,20 +34,18 @@ import javax.validation.Validation;
 import javax.validation.ValidationException;
 import javax.validation.Validator;
 import javax.validation.ValidatorFactory;
-import javax.validation.executable.ExecutableType;
 import javax.validation.spi.ConfigurationState;
 import java.io.Closeable;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Modifier;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 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.concurrent.ConcurrentMap;
 
 /**
  * Description: a factory is a complete configurated object that can create
@@ -74,10 +72,9 @@ public class ApacheValidatorFactory impl
     /**
      * access strategies for properties with cascade validation @Valid support
      */
-    private final Map<Class<?>, List<AccessStrategy>> validAccesses;
-    private final Map<Class<?>, List<MetaConstraint<?, ? extends Annotation>>>
constraintMap;
+    private final ConcurrentMap<Class<?>, List<AccessStrategy>> validAccesses;
+    private final ConcurrentMap<Class<?>, List<MetaConstraint<?, ? extends
Annotation>>> constraintMap;
 
-    private final Collection<ExecutableType> executableTypes = new CopyOnWriteArrayList<ExecutableType>();
     private final Collection<Closeable> toClose = new ArrayList<Closeable>();
 
     /**
@@ -85,10 +82,14 @@ public class ApacheValidatorFactory impl
      *
      * @return {@link ApacheValidatorFactory}
      */
-    public static synchronized ApacheValidatorFactory getDefault() {
+    public static ApacheValidatorFactory getDefault() {
         if (DEFAULT_FACTORY == null) {
-            DEFAULT_FACTORY = Validation.byProvider(ApacheValidationProvider.class).configure()
-                    .buildValidatorFactory().unwrap(ApacheValidatorFactory.class);
+            synchronized (ApacheValidatorFactory.class) {
+                if (DEFAULT_FACTORY == null) {
+                    DEFAULT_FACTORY = Validation.byProvider(ApacheValidationProvider.class).configure()
+                        .buildValidatorFactory().unwrap(ApacheValidatorFactory.class);
+                }
+            }
         }
         return DEFAULT_FACTORY;
     }
@@ -108,8 +109,8 @@ public class ApacheValidatorFactory impl
     public ApacheValidatorFactory(ConfigurationState configurationState) {
         properties = new HashMap<String, String>();
         defaultSequences = new HashMap<Class<?>, Class<?>[]>();
-        validAccesses = new HashMap<Class<?>, List<AccessStrategy>>();
-        constraintMap = new HashMap<Class<?>, List<MetaConstraint<?, ? extends
Annotation>>>();
+        validAccesses = new ConcurrentHashMap<Class<?>, List<AccessStrategy>>();
+        constraintMap = new ConcurrentHashMap<Class<?>, List<MetaConstraint<?,
? extends Annotation>>>();
         configure(configurationState);
     }
 
@@ -128,15 +129,7 @@ public class ApacheValidatorFactory impl
 
         if (ConfigurationImpl.class.isInstance(configuration)) {
             final ConfigurationImpl impl = ConfigurationImpl.class.cast(configuration);
-            executableTypes.addAll(impl.getExecutableValidation());
             toClose.add(impl.getClosable());
-        } else {
-            final String executableTypesStr = getProperties().remove(ApacheValidatorConfiguration.Properties.EXECUTABLE_VALIDATION_TYPES);
-            if (executableTypesStr != null && !executableTypesStr.isEmpty()) {
-                for (final String s : executableTypesStr.split(",")) {
-                    executableTypes.add(ExecutableType.valueOf(s.trim()));
-                }
-            }
         }
 
         new ValidationMappingParser(this).processMappingConfig(configuration.getMappingStreams());
@@ -342,12 +335,12 @@ public class ApacheValidatorFactory impl
      */
     public void addMetaConstraint(final Class<?> beanClass,
                                   final MetaConstraint<?, ?> metaConstraint) {
-        List<MetaConstraint<?, ? extends Annotation>> slot;
-        synchronized (constraintMap) {
-            slot = constraintMap.get(beanClass);
-            if (slot == null) {
-                slot = new ArrayList<MetaConstraint<?, ? extends Annotation>>();
-                constraintMap.put(beanClass, slot);
+        List<MetaConstraint<?, ? extends Annotation>> slot = constraintMap.get(beanClass);
+        if (slot == null) {
+            slot = new ArrayList<MetaConstraint<?, ? extends Annotation>>();
+            final List<MetaConstraint<?, ? extends Annotation>> old = constraintMap.putIfAbsent(beanClass,
slot);
+            if (old != null) {
+                slot = old;
             }
         }
         slot.add(metaConstraint);
@@ -361,12 +354,12 @@ public class ApacheValidatorFactory impl
      *            defining the property to validate
      */
     public void addValid(Class<?> beanClass, AccessStrategy accessStrategy) {
-        List<AccessStrategy> slot;
-        synchronized (validAccesses) {
-            slot = validAccesses.get(beanClass);
-            if (slot == null) {
-                slot = new ArrayList<AccessStrategy>();
-                validAccesses.put(beanClass, slot);
+        List<AccessStrategy> slot = validAccesses.get(beanClass);
+        if (slot == null) {
+            slot = new ArrayList<AccessStrategy>();
+            final List<AccessStrategy> old = validAccesses.putIfAbsent(beanClass, slot);
+            if (old != null) {
+                slot = old;
             }
         }
         slot.add(accessStrategy);
@@ -382,10 +375,6 @@ public class ApacheValidatorFactory impl
         defaultSequences.put(beanClass, safeArray(groupSequence));
     }
 
-    public Collection<ExecutableType> getExecutableTypes() {
-        return executableTypes;
-    }
-
     /**
      * Retrieve the runtime constraint configuration for a given class.
      *

Modified: bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/BeanDescriptorImpl.java
URL: http://svn.apache.org/viewvc/bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/BeanDescriptorImpl.java?rev=1514313&r1=1514312&r2=1514313&view=diff
==============================================================================
--- bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/BeanDescriptorImpl.java
(original)
+++ bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/BeanDescriptorImpl.java
Thu Aug 15 15:09:23 2013
@@ -97,13 +97,13 @@ public class BeanDescriptorImpl extends 
                     procedureDescriptors.add(getPropertyDescriptor(prop));
                 }
             }
-            metaBean.putFeature(Jsr303Features.Bean.PROPERTIES, procedureDescriptors);
+            procedureDescriptors = metaBean.initFeature(Jsr303Features.Bean.PROPERTIES, procedureDescriptors);
         }
 
         ExecutableMeta executables = metaBean.getFeature(Jsr303Features.Bean.EXECUTABLES);
         if (executables == null) { // caching the result of it is important to avoid to compute
it for each Validator
             executables = new ExecutableMeta(factoryContext, metaBean, getConstraintDescriptors());
-            metaBean.putFeature(Jsr303Features.Bean.EXECUTABLES, executables);
+            executables = metaBean.initFeature(Jsr303Features.Bean.EXECUTABLES, executables);
         }
 
         validatedProperties = Collections.unmodifiableSet(procedureDescriptors);

Modified: bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConfigurationImpl.java
URL: http://svn.apache.org/viewvc/bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConfigurationImpl.java?rev=1514313&r1=1514312&r2=1514313&view=diff
==============================================================================
--- bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConfigurationImpl.java
(original)
+++ bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConfigurationImpl.java
Thu Aug 15 15:09:23 2013
@@ -106,7 +106,7 @@ public class ConfigurationImpl implement
     private Map<String, String> properties = new HashMap<String, String>();
     private boolean ignoreXmlConfiguration = false;
 
-    private ValidationParser parser;
+    private volatile ValidationParser parser;
 
     /**
      * Create a new ConfigurationImpl instance.
@@ -251,15 +251,7 @@ public class ConfigurationImpl implement
     }
 
     public BootstrapConfiguration getBootstrapConfiguration() {
-        if (bootstrapConfiguration == null) {
-            synchronized (this) {
-                if (bootstrapConfiguration == null) {
-                    parser = parseValidationXml();
-                    bootstrapConfiguration = parser.getBootstrap();
-                }
-            }
-        }
-        return bootstrapConfiguration;
+        return createBootstrapConfiguration();
     }
 
     /**
@@ -294,14 +286,7 @@ public class ConfigurationImpl implement
             return this;
         }
 
-        if (parser == null) {
-            parser = parseValidationXml(); // already done if BootstrapConfiguration already
looked up
-            synchronized (this) { // this synchro should be done in a better way
-                if (bootstrapConfiguration == null) {
-                    bootstrapConfiguration = parser.getBootstrap();
-                }
-            }
-        }
+        createBootstrapConfiguration();
         parser.applyConfigWithInstantiation(this); // instantiate the config if needed
 
         // TODO: maybe find a better way to communicate between validator factory and config
@@ -313,6 +298,14 @@ public class ConfigurationImpl implement
         return this;
     }
 
+    private BootstrapConfiguration createBootstrapConfiguration() {
+        if (parser == null) {
+            parser = parseValidationXml(); // already done if BootstrapConfiguration already
looked up
+            bootstrapConfiguration = parser.getBootstrap();
+        }
+        return bootstrapConfiguration;
+    }
+
     /** Check whether a validation.xml file exists and parses it with JAXB */
     private ValidationParser parseValidationXml() {
         return ValidationParser.processValidationConfig(getProperties().get(Properties.VALIDATION_XML_PATH),
this, ignoreXmlConfiguration);

Modified: bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303MetaBeanFactory.java
URL: http://svn.apache.org/viewvc/bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303MetaBeanFactory.java?rev=1514313&r1=1514312&r2=1514313&view=diff
==============================================================================
--- bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303MetaBeanFactory.java
(original)
+++ bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303MetaBeanFactory.java
Thu Aug 15 15:09:23 2013
@@ -323,8 +323,7 @@ public class Jsr303MetaBeanFactory imple
         GroupSequence annotation = beanClass.getAnnotation(GroupSequence.class);
         List<Group> groupSeq = metabean.getFeature(key);
         if (groupSeq == null) {
-            groupSeq = new ArrayList<Group>(annotation == null ? 1 : annotation.value().length);
-            metabean.putFeature(key, groupSeq);
+            groupSeq = metabean.initFeature(key, new ArrayList<Group>(annotation ==
null ? 1 : annotation.value().length));
         }
         Class<?>[] groupClasses = factoryContext.getFactory().getDefaultSequence(beanClass);
         if (groupClasses == null || groupClasses.length == 0) {

Modified: bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/groups/GroupsComputer.java
URL: http://svn.apache.org/viewvc/bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/groups/GroupsComputer.java?rev=1514313&r1=1514312&r2=1514313&view=diff
==============================================================================
--- bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/groups/GroupsComputer.java
(original)
+++ bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/groups/GroupsComputer.java
Thu Aug 15 15:09:23 2013
@@ -24,6 +24,7 @@ import javax.validation.GroupSequence;
 import javax.validation.ValidationException;
 import javax.validation.groups.Default;
 import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
 
 /**
  * Description: compute group order, based on the RI behavior as to guarantee
@@ -40,8 +41,7 @@ public class GroupsComputer {
     }
 
     /** caching resolved groups in a thread-safe map. */
-    private final Map<Class<?>, List<Group>> resolvedSequences = Collections
-        .synchronizedMap(new HashMap<Class<?>, List<Group>>());
+    private final Map<Class<?>, List<Group>> resolvedSequences = new ConcurrentHashMap<Class<?>,
List<Group>>();
 
     /**
      * Compute groups from an array of group classes.

Modified: bval/branches/bval-11/bval-xstream/src/main/java/org/apache/bval/xml/XMLFeaturesCapable.java
URL: http://svn.apache.org/viewvc/bval/branches/bval-11/bval-xstream/src/main/java/org/apache/bval/xml/XMLFeaturesCapable.java?rev=1514313&r1=1514312&r2=1514313&view=diff
==============================================================================
--- bval/branches/bval-11/bval-xstream/src/main/java/org/apache/bval/xml/XMLFeaturesCapable.java
(original)
+++ bval/branches/bval-11/bval-xstream/src/main/java/org/apache/bval/xml/XMLFeaturesCapable.java
Thu Aug 15 15:09:23 2013
@@ -88,11 +88,9 @@ public class XMLFeaturesCapable implemen
 
     public void mergeFeaturesInto(FeaturesCapable fc) {
         if (getFeatures() != null) {
-            fc.optimizeRead(false);
             for (XMLMetaFeature each : getFeatures()) {
                 fc.putFeature(each.getKey(), each.getValue());
             }
-            fc.optimizeRead(true);
         }
     }
 }



Mime
View raw message