You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2012/02/23 11:50:58 UTC

svn commit: r1292738 - /karaf/branches/karaf-2.2.x/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AddFeaturesToRepoMojo.java

Author: jbonofre
Date: Thu Feb 23 10:50:58 2012
New Revision: 1292738

URL: http://svn.apache.org/viewvc?rev=1292738&view=rev
Log:
[KARAF-1216] Explicitily call the GC in order to purge the file handlers

Modified:
    karaf/branches/karaf-2.2.x/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AddFeaturesToRepoMojo.java

Modified: karaf/branches/karaf-2.2.x/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AddFeaturesToRepoMojo.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.2.x/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AddFeaturesToRepoMojo.java?rev=1292738&r1=1292737&r2=1292738&view=diff
==============================================================================
--- karaf/branches/karaf-2.2.x/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AddFeaturesToRepoMojo.java (original)
+++ karaf/branches/karaf-2.2.x/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AddFeaturesToRepoMojo.java Thu Feb 23 10:50:58 2012
@@ -182,8 +182,17 @@ public class AddFeaturesToRepoMojo exten
             List<Artifact> explicitRepoBundles = new ArrayList<Artifact>();
 
             getLog().info("Base repo: " + localRepo.getUrl());
+            int currentBundle = 0;
             for (String bundle : bundles) {
                 Artifact artifact = resourceToArtifact(bundle, skipNonMavenProtocols);
+
+                // Maven ArtifactResolver leaves file handles around so need to clean up
+                // or we will run out of file descriptors
+                if (currentBundle++ % 100 == 0) {
+                    System.gc();
+                    System.runFinalization();
+                }
+
                 if (artifact == null) {
                     continue;
                 }