From a9fcd5d108eaef4551a2346467ca8ea3e7a4a887 Mon Sep 17 00:00:00 2001 From: Kristian Rosenvold Date: Fri, 18 Jun 2010 19:09:42 +0000 Subject: [PATCH] [MNG-4682] Exception upon build failure in parallel builds Also removed duplicated code line git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@956100 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/maven/lifecycle/internal/LifecycleStarter.java | 4 ++++ .../maven/lifecycle/internal/LifecycleThreadedBuilder.java | 7 +------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleStarter.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleStarter.java index 0bd86c0949..cef192820a 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleStarter.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleStarter.java @@ -29,6 +29,7 @@ import java.util.List; import java.util.concurrent.CompletionService; import java.util.concurrent.ExecutorCompletionService; import java.util.concurrent.ExecutorService; +import java.util.concurrent.TimeUnit; /** * Starts the build life cycle @@ -144,6 +145,9 @@ public class LifecycleStarter finally { executor.shutdown(); + // If the builder has terminated with an exception we want to catch any stray threads before going + // to System.exit in the mavencli. + executor.awaitTermination( 5, TimeUnit.SECONDS ) ; } } else diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleThreadedBuilder.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleThreadedBuilder.java index 8f0b407b56..a413b4d5fa 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleThreadedBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleThreadedBuilder.java @@ -66,12 +66,7 @@ public class LifecycleThreadedBuilder try { multiThreadedProjectTaskSegmentBuild( analyzer, reactorContext, session, service, taskSegment, projectBuildMap, muxer ); - if ( reactorContext.getReactorBuildStatus().isHalted() ) - { - break; - } - - if ( reactorContext.getReactorBuildStatus().isHalted() ) + if ( reactorContext.getReactorBuildStatus().isHalted( ) ) { break; }