mirror of https://github.com/apache/maven.git
Changed to threadsafe Map/Set structures
The changed classes have confirmed unsafe concurrent access using failfast-collections git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@906463 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7d8835762c
commit
6c59fced77
|
@ -24,6 +24,7 @@ import java.util.HashSet;
|
|||
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 @@ public class DefaultArtifactFilterManager
|
|||
|
||||
static
|
||||
{
|
||||
Set<String> artifacts = new HashSet<String>();
|
||||
List<String> artifacts = new ArrayList<String>();
|
||||
|
||||
artifacts.add( "classworlds" );
|
||||
artifacts.add( "plexus-classworlds" );
|
||||
|
@ -86,7 +87,7 @@ public class DefaultArtifactFilterManager
|
|||
* wagon from their plugin realm.
|
||||
*/
|
||||
|
||||
DEFAULT_EXCLUSIONS = artifacts;
|
||||
DEFAULT_EXCLUSIONS = new CopyOnWriteArraySet<String>( artifacts);
|
||||
}
|
||||
|
||||
protected Set<String> excludedArtifacts = new HashSet<String>( DEFAULT_EXCLUSIONS );
|
||||
|
|
|
@ -23,11 +23,11 @@ import java.io.File;
|
|||
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 @@ public class MavenSession
|
|||
|
||||
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 @@ public class MavenSession
|
|||
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 @@ public class MavenSession
|
|||
|
||||
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 @@ public class MavenSession
|
|||
|
||||
if ( pluginContext == null )
|
||||
{
|
||||
pluginContext = new HashMap<String, Object>();
|
||||
pluginContext = new ConcurrentHashMap<String, Object>();
|
||||
|
||||
pluginContextsByKey.put( pluginKey, pluginContext );
|
||||
}
|
||||
|
|
|
@ -19,8 +19,8 @@ package org.apache.maven.execution;
|
|||
* 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 @@ class SessionRepositoryCache
|
|||
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 )
|
||||
{
|
||||
|
|
|
@ -21,10 +21,10 @@ package org.apache.maven.plugin;
|
|||
|
||||
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 @@ public class DefaultPluginRealmCache
|
|||
}
|
||||
}
|
||||
|
||||
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,
|
||||
|
|
|
@ -18,13 +18,13 @@ package org.apache.maven.project.artifact;
|
|||
|
||||
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 @@ public class DefaultMavenMetadataCache
|
|||
implements MavenMetadataCache
|
||||
{
|
||||
|
||||
protected final Map<CacheKey, CacheRecord> cache = new ConcurrentHashMap<CacheKey, CacheRecord>();
|
||||
|
||||
public static class CacheKey
|
||||
{
|
||||
private final Artifact artifact;
|
||||
|
@ -286,7 +288,6 @@ public class DefaultMavenMetadataCache
|
|||
}
|
||||
}
|
||||
|
||||
protected Map<CacheKey, CacheRecord> cache = new HashMap<CacheKey, CacheRecord>();
|
||||
|
||||
public ResolutionGroup get( Artifact artifact, boolean resolveManagedVersions, ArtifactRepository localRepository,
|
||||
List<ArtifactRepository> remoteRepositories )
|
||||
|
|
Loading…
Reference in New Issue