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 void execute( MavenSession session )
}
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 );
}

View File

@ -1087,15 +1087,24 @@ else if ( commandLine.hasOption( CLIManager.ALSO_MAKE )
if ( threadConfiguration != null )
{
//
// Default to the standard multithreaded builder
//
request.setBuilderId( "multithreaded" );
int threads =
threadConfiguration.contains( "C" ) ? Integer.valueOf( threadConfiguration.replace( "C", "" ) )
* Runtime.getRuntime().availableProcessors() : Integer.valueOf( threadConfiguration );
request.setDegreeOfConcurrency( threads );
}
if ( threadConfiguration.contains( "C" ) )
{
request.setDegreeOfConcurrency( (int) ( Float.valueOf( threadConfiguration.replace( "C", "" ) ) * Runtime.getRuntime().availableProcessors() ) );
}
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 ) )
{
request.setBuilderId( commandLine.getOptionValue( CLIManager.BUILDER ) );