You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2022/05/02 14:44:03 UTC
[maven-toolchains-plugin] branch master updated: [MTOOLCHAINS-31] - Not threadsafe for parallel execution (#8)
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-toolchains-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new d4f73c0 [MTOOLCHAINS-31] - Not threadsafe for parallel execution (#8)
d4f73c0 is described below
commit d4f73c0e28f1b1b2d9a4cca5179f80c9b7458e93
Author: Thomas Reinhardt <th...@reinhardt.com>
AuthorDate: Mon May 2 16:43:58 2022 +0200
[MTOOLCHAINS-31] - Not threadsafe for parallel execution (#8)
Co-authored-by: Thomas Reinhardt <th...@s4p.de>
---
.../java/org/apache/maven/plugins/toolchain/ToolchainMojo.java | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/maven/plugins/toolchain/ToolchainMojo.java b/src/main/java/org/apache/maven/plugins/toolchain/ToolchainMojo.java
index 7cef3d7..37ab11a 100644
--- a/src/main/java/org/apache/maven/plugins/toolchain/ToolchainMojo.java
+++ b/src/main/java/org/apache/maven/plugins/toolchain/ToolchainMojo.java
@@ -42,10 +42,12 @@ import java.util.Map;
* @author mkleint
*/
@Mojo( name = "toolchain", defaultPhase = LifecyclePhase.VALIDATE,
- configurator = "toolchains-requirement-configurator" )
+ configurator = "toolchains-requirement-configurator",
+ threadSafe = true )
public class ToolchainMojo
extends AbstractMojo
{
+ private static final Object LOCK = new Object();
/**
*/
@@ -160,7 +162,10 @@ public class ToolchainMojo
getLog().info( "Found matching toolchain for type " + type + ": " + tc );
// store matching toolchain to build context
- toolchainManagerPrivate.storeToolchainToBuildContext( tc, session );
+ synchronized ( LOCK )
+ {
+ toolchainManagerPrivate.storeToolchainToBuildContext( tc, session );
+ }
return true;
}