Fix for multithreading configuration where you have something like -TC2.2

This commit is contained in:
Jason van Zyl 2014-02-12 11:42:20 -05:00
parent d8c57c441d
commit 30fadd074e
2 changed files with 18 additions and 9 deletions

View File

@ -112,7 +112,7 @@ public class LifecycleStarter
} }
logger.info( "" ); logger.info( "" );
logger.info( String.format( "Using the builder %s", builder.getClass().getName() ) ); logger.info( String.format( "Using the builder %s with a thread count of %s", builder.getClass().getName(), session.getRequest().getDegreeOfConcurrency() ) );
builder.build( session, reactorContext, projectBuilds, taskSegments, reactorBuildStatus ); builder.build( session, reactorContext, projectBuilds, taskSegments, reactorBuildStatus );
} }

View File

@ -1087,15 +1087,24 @@ public class MavenCli
if ( threadConfiguration != null ) if ( threadConfiguration != null )
{ {
//
// Default to the standard multithreaded builder
//
request.setBuilderId( "multithreaded" ); request.setBuilderId( "multithreaded" );
int threads = if ( threadConfiguration.contains( "C" ) )
threadConfiguration.contains( "C" ) ? Integer.valueOf( threadConfiguration.replace( "C", "" ) ) {
* Runtime.getRuntime().availableProcessors() : Integer.valueOf( threadConfiguration ); request.setDegreeOfConcurrency( (int) ( Float.valueOf( threadConfiguration.replace( "C", "" ) ) * Runtime.getRuntime().availableProcessors() ) );
}
request.setDegreeOfConcurrency( threads ); else
} {
request.setDegreeOfConcurrency( Integer.valueOf( threadConfiguration ) );
}
}
//
// Allow the builder to be overriden by the user if requested. The builders are now pluggable.
//
if ( commandLine.hasOption( CLIManager.BUILDER ) ) if ( commandLine.hasOption( CLIManager.BUILDER ) )
{ {
request.setBuilderId( commandLine.getOptionValue( CLIManager.BUILDER ) ); request.setBuilderId( commandLine.getOptionValue( CLIManager.BUILDER ) );