You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kr...@apache.org on 2012/11/30 08:12:36 UTC
[1/2] git commit: o Changed array to atomicreference since arrays are
not thread-safe
Updated Branches:
refs/heads/master 620137ebc -> 2103c82d5
o Changed array to atomicreference since arrays are not thread-safe
Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/2103c82d
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/2103c82d
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/2103c82d
Branch: refs/heads/master
Commit: 2103c82d57b3f617cafa2796efeda97b85369465
Parents: e8df4ca
Author: Kristian Rosenvold <kr...@gmail.com>
Authored: Thu Nov 29 22:17:04 2012 +0100
Committer: Kristian Rosenvold <kr...@apache.org>
Committed: Fri Nov 30 07:33:31 2012 +0100
----------------------------------------------------------------------
.../plugin/internal/DefaultLegacySupport.java | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven/blob/2103c82d/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultLegacySupport.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultLegacySupport.java b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultLegacySupport.java
index aea0963..53e5f30 100644
--- a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultLegacySupport.java
+++ b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultLegacySupport.java
@@ -19,9 +19,11 @@ package org.apache.maven.plugin.internal;
* under the License.
*/
+import java.util.concurrent.atomic.AtomicReference;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.LegacySupport;
import org.codehaus.plexus.component.annotations.Component;
+
import org.sonatype.aether.RepositorySystemSession;
/**
@@ -37,29 +39,29 @@ public class DefaultLegacySupport
implements LegacySupport
{
- private static final ThreadLocal<MavenSession[]> session = new InheritableThreadLocal<MavenSession[]>();
+ private static final ThreadLocal<AtomicReference<MavenSession>> session = new InheritableThreadLocal<AtomicReference<MavenSession>>();
public void setSession( MavenSession session )
{
if ( session == null )
{
- MavenSession[] oldSession = DefaultLegacySupport.session.get();
+ AtomicReference<MavenSession> oldSession = DefaultLegacySupport.session.get();
if ( oldSession != null )
{
- oldSession[0] = null;
+ oldSession.set( null);
DefaultLegacySupport.session.remove();
}
}
else
{
- DefaultLegacySupport.session.set( new MavenSession[] { session } );
+ DefaultLegacySupport.session.set( new AtomicReference<MavenSession>( session ));
}
}
public MavenSession getSession()
{
- MavenSession[] currentSession = DefaultLegacySupport.session.get();
- return currentSession != null ? currentSession[0] : null;
+ AtomicReference<MavenSession> currentSession = DefaultLegacySupport.session.get();
+ return currentSession != null ? currentSession.get() : null;
}
public RepositorySystemSession getRepositorySession()