[MNG-6030] ReactorModelCache do not used effectively after maven version 3.0.5 which cause a large memory footprint

o Reintroduced ReactorModelCache reduces the memory footprint.
This commit is contained in:
Karl Heinz Marbaise 2016-05-31 21:39:31 +02:00
parent 733eedc4fb
commit cfb075ac70
1 changed files with 11 additions and 6 deletions

View File

@ -116,14 +116,14 @@ public class DefaultProjectBuilder
public ProjectBuildingResult build( File pomFile, ProjectBuildingRequest request ) public ProjectBuildingResult build( File pomFile, ProjectBuildingRequest request )
throws ProjectBuildingException throws ProjectBuildingException
{ {
return build( pomFile, new FileModelSource( pomFile ), new InternalConfig( request, null ) ); return build( pomFile, new FileModelSource( pomFile ), new InternalConfig( request, null, null ) );
} }
@Override @Override
public ProjectBuildingResult build( ModelSource modelSource, ProjectBuildingRequest request ) public ProjectBuildingResult build( ModelSource modelSource, ProjectBuildingRequest request )
throws ProjectBuildingException throws ProjectBuildingException
{ {
return build( null, modelSource, new InternalConfig( request, null ) ); return build( null, modelSource, new InternalConfig( request, null, null ) );
} }
private ProjectBuildingResult build( File pomFile, ModelSource modelSource, InternalConfig config ) private ProjectBuildingResult build( File pomFile, ModelSource modelSource, InternalConfig config )
@ -275,7 +275,7 @@ public class DefaultProjectBuilder
request.setUserProperties( configuration.getUserProperties() ); request.setUserProperties( configuration.getUserProperties() );
request.setBuildStartTime( configuration.getBuildStartTime() ); request.setBuildStartTime( configuration.getBuildStartTime() );
request.setModelResolver( resolver ); request.setModelResolver( resolver );
request.setModelCache( new ReactorModelCache() ); request.setModelCache( config.modelCache );
return request; return request;
} }
@ -294,7 +294,7 @@ public class DefaultProjectBuilder
org.eclipse.aether.artifact.Artifact pomArtifact = RepositoryUtils.toArtifact( artifact ); org.eclipse.aether.artifact.Artifact pomArtifact = RepositoryUtils.toArtifact( artifact );
pomArtifact = ArtifactDescriptorUtils.toPomArtifact( pomArtifact ); pomArtifact = ArtifactDescriptorUtils.toPomArtifact( pomArtifact );
InternalConfig config = new InternalConfig( request, null ); InternalConfig config = new InternalConfig( request, null, null );
boolean localProject; boolean localProject;
@ -394,7 +394,9 @@ public class DefaultProjectBuilder
ReactorModelPool modelPool = new ReactorModelPool(); ReactorModelPool modelPool = new ReactorModelPool();
InternalConfig config = new InternalConfig( request, modelPool ); ReactorModelCache modelCache = new ReactorModelCache();
InternalConfig config = new InternalConfig( request, modelPool, modelCache );
Map<String, MavenProject> projectIndex = new HashMap<>( 256 ); Map<String, MavenProject> projectIndex = new HashMap<>( 256 );
@ -914,10 +916,13 @@ public class DefaultProjectBuilder
public final ReactorModelPool modelPool; public final ReactorModelPool modelPool;
InternalConfig( ProjectBuildingRequest request, ReactorModelPool modelPool ) public final ReactorModelCache modelCache;
InternalConfig( ProjectBuildingRequest request, ReactorModelPool modelPool, ReactorModelCache modelCache )
{ {
this.request = request; this.request = request;
this.modelPool = modelPool; this.modelPool = modelPool;
this.modelCache = modelCache;
session = session =
LegacyLocalRepositoryManager.overlay( request.getLocalRepository(), request.getRepositorySession(), LegacyLocalRepositoryManager.overlay( request.getLocalRepository(), request.getRepositorySession(),
repoSystem ); repoSystem );