maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krosenv...@apache.org
Subject svn commit: r906463 - in /maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven: ./ execution/ plugin/ project/artifact/
Date Thu, 04 Feb 2010 12:12:15 GMT
Author: krosenvold
Date: Thu Feb  4 12:12:14 2010
New Revision: 906463

URL: http://svn.apache.org/viewvc?rev=906463&view=rev
Log:
Changed to threadsafe Map/Set structures

The changed classes have confirmed unsafe concurrent access using failfast-collections

Modified:
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/DefaultArtifactFilterManager.java
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/SessionRepositoryCache.java
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginRealmCache.java
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMavenMetadataCache.java

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/DefaultArtifactFilterManager.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/DefaultArtifactFilterManager.java?rev=906463&r1=906462&r2=906463&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/DefaultArtifactFilterManager.java
(original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/DefaultArtifactFilterManager.java
Thu Feb  4 12:12:14 2010
@@ -24,6 +24,7 @@
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
+import java.util.concurrent.CopyOnWriteArraySet;
 
 import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
 import org.apache.maven.artifact.resolver.filter.ExclusionSetFilter;
@@ -49,7 +50,7 @@
 
     static
     {
-        Set<String> artifacts = new HashSet<String>();
+        List<String> artifacts = new ArrayList<String>();
 
         artifacts.add( "classworlds" );
         artifacts.add( "plexus-classworlds" );
@@ -86,7 +87,7 @@
          * wagon from their plugin realm.
          */
 
-        DEFAULT_EXCLUSIONS = artifacts;
+        DEFAULT_EXCLUSIONS = new CopyOnWriteArraySet<String>( artifacts);
     }
 
     protected Set<String> excludedArtifacts = new HashSet<String>( DEFAULT_EXCLUSIONS
);

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java?rev=906463&r1=906462&r2=906463&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java
(original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java
Thu Feb  4 12:12:14 2010
@@ -23,11 +23,11 @@
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Date;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
+import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.repository.RepositoryCache;
@@ -69,6 +69,9 @@
 
     private Collection<String> blackListedProjects;
 
+    private final Map<String,Map<String,Map<String,Object>>>  pluginContextsByProjectAndPluginKey
=
+        new ConcurrentHashMap<String,Map<String,Map<String,Object>>> ();
+
     @Deprecated
     public MavenSession( PlexusContainer container, MavenExecutionRequest request, MavenExecutionResult
result, MavenProject project )
     {
@@ -284,8 +287,7 @@
         return result;
     }        
 
-    private Map<String,Map<String,Map<String,Object>>>  pluginContextsByProjectAndPluginKey
= new HashMap<String,Map<String,Map<String,Object>>> ();
-    
+
     // Backward compat
     public Map<String, Object> getPluginContext( PluginDescriptor plugin, MavenProject
project )
     {
@@ -295,7 +297,7 @@
 
         if ( pluginContextsByKey == null )
         {
-            pluginContextsByKey = new HashMap<String, Map<String, Object>>();
+            pluginContextsByKey = new ConcurrentHashMap<String, Map<String, Object>>();
 
             pluginContextsByProjectAndPluginKey.put( projectKey, pluginContextsByKey );
         }
@@ -306,7 +308,7 @@
 
         if ( pluginContext == null )
         {
-            pluginContext = new HashMap<String, Object>();
+            pluginContext = new ConcurrentHashMap<String, Object>();
 
             pluginContextsByKey.put( pluginKey, pluginContext );
         }

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/SessionRepositoryCache.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/SessionRepositoryCache.java?rev=906463&r1=906462&r2=906463&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/SessionRepositoryCache.java
(original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/SessionRepositoryCache.java
Thu Feb  4 12:12:14 2010
@@ -19,8 +19,8 @@
  * under the License.
  */
 
-import java.util.HashMap;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.maven.artifact.repository.RepositoryCache;
 import org.apache.maven.artifact.repository.RepositoryRequest;
@@ -34,7 +34,7 @@
     implements RepositoryCache
 {
 
-    private Map<Object, Object> cache = new HashMap<Object, Object>( 256 );
+    private Map<Object, Object> cache = new ConcurrentHashMap<Object, Object>(
256 );
 
     public Object get( RepositoryRequest request, Object key )
     {

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginRealmCache.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginRealmCache.java?rev=906463&r1=906462&r2=906463&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginRealmCache.java
(original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginRealmCache.java
Thu Feb  4 12:12:14 2010
@@ -21,10 +21,10 @@
 
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -105,7 +105,7 @@
         }
     }
 
-    protected final Map<CacheKey, CacheRecord> cache = new HashMap<CacheKey, CacheRecord>();
+    protected final Map<CacheKey, CacheRecord> cache = new ConcurrentHashMap<CacheKey,
CacheRecord>();
 
     public CacheRecord get( Plugin plugin, ClassLoader parentRealm, List<String> parentImports,
                             ArtifactFilter dependencyFilter, ArtifactRepository localRepository,

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMavenMetadataCache.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMavenMetadataCache.java?rev=906463&r1=906462&r2=906463&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMavenMetadataCache.java
(original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMavenMetadataCache.java
Thu Feb  4 12:12:14 2010
@@ -18,13 +18,13 @@
 
 import java.io.File;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.ArtifactUtils;
@@ -38,6 +38,8 @@
     implements MavenMetadataCache
 {
 
+    protected final Map<CacheKey, CacheRecord> cache = new ConcurrentHashMap<CacheKey,
CacheRecord>();
+    
     public static class CacheKey 
     {
         private final Artifact artifact;
@@ -286,7 +288,6 @@
         }
     }
 
-    protected Map<CacheKey, CacheRecord> cache = new HashMap<CacheKey, CacheRecord>();
 
     public ResolutionGroup get( Artifact artifact, boolean resolveManagedVersions, ArtifactRepository
localRepository,
                                 List<ArtifactRepository> remoteRepositories )



Mime
View raw message