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 2019/04/01 06:22:09 UTC

[maven] 01/01: MNG-6471 during parallel build, ensure to set the thread name to the module name

This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch MNG-6471
in repository https://gitbox.apache.org/repos/asf/maven.git

commit ffdc43a16b724d99da6b432138fefc5e747c0408
Author: Romain Manni-Bucau <rm...@gmail.com>
AuthorDate: Thu Sep 6 11:08:14 2018 +0200

    MNG-6471 during parallel build, ensure to set the thread name to the module name
    
    Closes #177
---
 .../multithreaded/MultiThreadedBuilder.java        | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/MultiThreadedBuilder.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/MultiThreadedBuilder.java
index bfbfb02..6e10ab7 100644
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/MultiThreadedBuilder.java
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/MultiThreadedBuilder.java
@@ -198,12 +198,24 @@ public class MultiThreadedBuilder
         {
             public ProjectSegment call()
             {
-                // muxer.associateThreadWithProjectSegment( projectBuild );
-                lifecycleModuleBuilder.buildProject( projectBuild.getSession(), rootSession, reactorContext,
-                                                     projectBuild.getProject(), taskSegment );
-                // muxer.setThisModuleComplete( projectBuild );
+                final Thread currentThread = Thread.currentThread();
+                final String originalThreadName = currentThread.getName();
+                currentThread.setName( projectBuild.getProject().getArtifactId() );
 
-                return projectBuild;
+                try
+                {
+                    // muxer.associateThreadWithProjectSegment( projectBuild );
+                    lifecycleModuleBuilder.buildProject(
+                            projectBuild.getSession(), rootSession, reactorContext,
+                            projectBuild.getProject(), taskSegment );
+                    // muxer.setThisModuleComplete( projectBuild );
+
+                    return projectBuild;
+                }
+                finally
+                {
+                    currentThread.setName( originalThreadName );
+                }
             }
         };
     }