Hey Karl,

This is the list of concurrency issues in Maven.

http://jira.codehaus.org/browse/MNG-5705?jql=project%20%3D%20MNG%20AND%20status%20%3D%20Open%20AND%20text%20~%20%22parallel%22

The funny thing with such of these issues is that they may not appear in
another environments and new may appear over and over again untill all
concurrent objects are immutable, or are at least having safe multithread
visibility, or they are ideally fully thread-safe.

I have fixed MavenProject.class in my private copy, and I have problem
because all collections in maven-core couldn't be fixed as I wanted.

Our general problem in maven-core is with sharing collections (List/Map)
across objects. This means somebody sets the collection instance in POJO and
whole Maven core shares the same instance and retrieves the same instance.
I understand the Plugins would like to add new Maven properties into a
collection, but it does not mean that the Maven itself should do the same.
The Mvane code should build POJO in a builder and then never share the
collection instances.

Example regarding bad Java concurrency implementation is
DefaultMavenExecutionResult.class, MavenProject.class, DefaultArtifact.class
which are stateful and fully modifiable.
Sharing collections across objects. Is this intended?

I would like to make a copy of set collection in
DefaultArtifact#dependencyTrail, but my problem is with this statement in
LifecycleDependencyResolver.java:
artifact.setDependencyTrail( resolved.getDependencyTrail() );

Similar problem in DefaultLegacyArtifactCollector.java:
resetArtifact.setAvailableVersions( versions );

An example of implementation with good visibility in DefaultArtifact.class
is this change i have made:

private final Map<Object, ArtifactMetadata> metadataMap =
new ConcurrentHashMap<Object, ArtifactMetadata>( 0 );

public Collection<ArtifactMetadata> getMetadataList()
{
        return Collections.unmodifiableCollection( metadataMap.values() );
}

public void addMetadataList(...) { ... metadataMap ...}

I don't expect semi-sequential ordering here.



--
View this message in context: 
http://maven.40175.n5.nabble.com/Maven-Commit-3b671d07340b002e13775883d09e7f7e0d9a3c49-tp5821660p5821736.html
Sent from the Maven Developers mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to