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_r250924625
 
 

 ##########
 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:
   You could do that by using a ExecutionService which runs the workers in the 
same thread like the DirectExecutor from 
https://google.github.io/guava/releases/24.0-jre/api/docs/index.html?com/google/common/util/concurrent/MoreExecutors.html

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to