AlexanderAshitkin commented on a change in pull request #290: [MNG-6774] - 
Speedup project graph build by paralleling operations
URL: https://github.com/apache/maven/pull/290#discussion_r383087227
 
 

 ##########
 File path: 
maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java
 ##########
 @@ -401,18 +403,49 @@ else if ( selectedProject.isDirectory() )
             return projects;
         }
 
-        List<File> files = Arrays.asList( request.getPom().getAbsoluteFile() );
+        List<File> files = Collections.singletonList( 
request.getPom().getAbsoluteFile() );
         collectProjects( projects, files, request );
         return projects;
     }
 
-    private void collectProjects( List<MavenProject> projects, List<File> 
files, MavenExecutionRequest request )
-        throws ProjectBuildingException
+    private void collectProjects( List<MavenProject> projects, final 
List<File> files,
+                                  final MavenExecutionRequest request ) throws 
ProjectBuildingException
     {
-        ProjectBuildingRequest projectBuildingRequest = 
request.getProjectBuildingRequest();
+        final ProjectBuildingRequest projectBuildingRequest = 
request.getProjectBuildingRequest();
+
+        List<ProjectBuildingResult> results;
+        long start = System.currentTimeMillis();
+        if ( request.getDegreeOfConcurrency() <= 1 || Boolean.getBoolean( 
"maven.concurrentGraph.disable" ) )
+        {
+            results = projectBuilder.build( files, request.isRecursive(), 
projectBuildingRequest );
+        }
+        else
+        {
+            ForkJoinPool forkJoinPool = new ForkJoinPool( 
request.getDegreeOfConcurrency(),
 
 Review comment:
   removed. in this implementation FJP async mode is not critical, so i removed 
that flag for simplicity. initially idea was to enforce fifo for for incoming 
tasks, but because all tasks are joined, this is not critical here.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to