Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Fedorenko2011-04-30 00:42:45 -0400
committerIgor Fedorenko2011-04-30 00:42:45 -0400
commite6f6f17cd7c71216585f14b2d5cc6ff6e4c49699 (patch)
tree89b29ed9eeccc01f0c50598ab3bbd49e70d8a012
parent564c8ccc38e831299e8c0dff5bf179a98e03ae50 (diff)
downloadm2e-core-e6f6f17cd7c71216585f14b2d5cc6ff6e4c49699.tar.gz
m2e-core-e6f6f17cd7c71216585f14b2d5cc6ff6e4c49699.tar.xz
m2e-core-e6f6f17cd7c71216585f14b2d5cc6ff6e4c49699.zip
Do not keep mapping metadata source in registry
Nullify source references of plugin execution metadata stored in project registry. It is held by a transient field, so it does not survive workspace restart and no logic should rely on it's presence in registry. This change fully addresses excessive project registry heap use identified in commit d14848a. For the test set of 56 projects, registry heap usage goes from ~100M down to ~50M after this change. (before d14848a registry used >500M of heap). Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/ProjectRegistryManager.java20
1 files changed, 19 insertions, 1 deletions
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/ProjectRegistryManager.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/ProjectRegistryManager.java
index dbb593bc..1aeb1fd8 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/ProjectRegistryManager.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/ProjectRegistryManager.java
@@ -69,17 +69,20 @@ import org.eclipse.m2e.core.internal.Messages;
import org.eclipse.m2e.core.internal.embedder.MavenImpl;
import org.eclipse.m2e.core.internal.lifecyclemapping.LifecycleMappingFactory;
import org.eclipse.m2e.core.internal.lifecyclemapping.LifecycleMappingResult;
+import org.eclipse.m2e.core.internal.lifecyclemapping.model.PluginExecutionMetadata;
import org.eclipse.m2e.core.internal.markers.IMavenMarkerManager;
import org.eclipse.m2e.core.internal.markers.MarkerUtils;
import org.eclipse.m2e.core.internal.project.DependencyResolutionContext;
import org.eclipse.m2e.core.internal.project.IManagedCache;
import org.eclipse.m2e.core.internal.project.ResolverConfigurationIO;
+import org.eclipse.m2e.core.lifecyclemapping.model.IPluginExecutionMetadata;
import org.eclipse.m2e.core.project.IMavenProjectChangedListener;
import org.eclipse.m2e.core.project.IMavenProjectFacade;
import org.eclipse.m2e.core.project.MavenProjectChangedEvent;
import org.eclipse.m2e.core.project.MavenUpdateRequest;
import org.eclipse.m2e.core.project.ResolverConfiguration;
import org.eclipse.m2e.core.project.configurator.ILifecycleMapping;
+import org.eclipse.m2e.core.project.configurator.MojoExecutionKey;
/**
* This class keeps track of all maven projects present in the workspace and
@@ -524,7 +527,12 @@ public class ProjectRegistryManager {
monitor);
newFacade.setLifecycleMappingId(mappingResult.getLifecycleMappingId());
- newFacade.setMojoExecutionMapping(mappingResult.getMojoExecutionMapping());
+ Map<MojoExecutionKey, List<IPluginExecutionMetadata>> mojoExecutionMapping = mappingResult
+ .getMojoExecutionMapping();
+ if(mojoExecutionMapping != null) {
+ detachMappingSources(mojoExecutionMapping);
+ }
+ newFacade.setMojoExecutionMapping(mojoExecutionMapping);
// XXX reconcile with corresponding LifecycleMappingFactory methods
newFacade.setSessionProperty(MavenProjectFacade.PROP_LIFECYCLE_MAPPING, mappingResult.getLifecycleMapping());
@@ -537,6 +545,16 @@ public class ProjectRegistryManager {
}
}
+ private void detachMappingSources(Map<MojoExecutionKey, List<IPluginExecutionMetadata>> mapping) {
+ for(List<IPluginExecutionMetadata> executions : mapping.values()) {
+ if(executions != null) {
+ for(IPluginExecutionMetadata execution : executions) {
+ ((PluginExecutionMetadata) execution).setSource(null);
+ }
+ }
+ }
+ }
+
static <T> Set<T> diff(Set<T> a, Set<T> b) {
if(a == null || a.isEmpty()) {
if(b == null || b.isEmpty()) {

Back to the top