You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2019/01/22 13:33:15 UTC

[GitHub] digulla commented on a change in pull request #5: [MDEPLOY-206] Support parallel deploy at end

digulla commented on a change in pull request #5: [MDEPLOY-206] Support parallel deploy at end
URL: https://github.com/apache/maven-deploy-plugin/pull/5#discussion_r249779684
 
 

 ##########
 File path: src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java
 ##########
 @@ -170,12 +183,71 @@ public void execute()
         {
             synchronized ( DEPLOYREQUESTS )
             {
-                while ( !DEPLOYREQUESTS.isEmpty() )
+                int requests = DEPLOYREQUESTS.size();
+                CompletionService<String> service = null;
+                if ( threads > 1 )
                 {
-                    ArtifactRepository repo = getDeploymentRepository( DEPLOYREQUESTS.get( 0 ) );
+                    service = new ExecutorCompletionService( new ScheduledThreadPoolExecutor( threads ) );
+                    getLog().info( "Deploying with " + threads + " threads" );
+                }
 
-                    deployProject( getSession().getProjectBuildingRequest(), DEPLOYREQUESTS.remove( 0 ), repo );
+                for ( final ProjectDeployerRequest projectDeployerRequest : DEPLOYREQUESTS )
+                {
+                    Callable<String> callable = new Callable<String>()
+                    {
+                        @Override
+                        public String call() throws Exception
+                        {
+                            ArtifactRepository repo = getDeploymentRepository( projectDeployerRequest );
+                            deployProject( getSession().getProjectBuildingRequest(), projectDeployerRequest, repo );
+                            return projectDeployerRequest.getProject().getName();
+                        }
+                    };
+
+                    if ( threads > 1 )
+                    {
+                        getLog().info( "Submitting " + projectDeployerRequest.getProject().getName() );
+                        service.submit( callable );
+                    }
+                    else
 
 Review comment:
   The `else` could be avoided by using an executor with just a single worker thread.

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


With regards,
Apache Git Services