maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rfscho...@apache.org
Subject [maven] 03/12: [MNG-6720] MultiThreadedBuilder: wait for parallel running projects when using --fail-fast
Date Sat, 24 Aug 2019 16:25:27 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit eeea0bb98c1d4d205914c5acaf85d0b620b01c0a
Author: Stefan Oehme <st.oehme@gmail.com>
AuthorDate: Tue Jul 23 12:25:34 2019 +0200

    [MNG-6720] MultiThreadedBuilder: wait for parallel running projects when using --fail-fast
    
    Otherwise the sessionFinished event may be sent before some
    projects/goals finish, which violates the contracts of execution
    listeners and makes it hard to properly life cycle components that
    are needed for goal execution.
    
    This closes #272
---
 .../builder/multithreaded/MultiThreadedBuilder.java  | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 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..94d10af 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
@@ -27,7 +27,7 @@ import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ExecutorCompletionService;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.lifecycle.internal.BuildThreadFactory;
@@ -114,6 +114,9 @@ public class MultiThreadedBuilder
             }
 
         }
+
+        executor.shutdown();
+        executor.awaitTermination( Long.MAX_VALUE, TimeUnit.MILLISECONDS );
     }
 
     private void multiThreadedProjectTaskSegmentBuild( ConcurrencyDependencyGraph analyzer,
@@ -172,21 +175,6 @@ public class MultiThreadedBuilder
                 break;
             }
         }
-
-        // cancel outstanding builds (if any) - this can happen if an exception is thrown
in above block
-
-        Future<ProjectSegment> unprocessed;
-        while ( ( unprocessed = service.poll() ) != null )
-        {
-            try
-            {
-                unprocessed.get();
-            }
-            catch ( InterruptedException | ExecutionException e )
-            {
-                throw new RuntimeException( e );
-            }
-        }
     }
 
     private Callable<ProjectSegment> createBuildCallable( final MavenSession rootSession,


Mime
View raw message