You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by cs...@apache.org on 2012/08/15 15:16:23 UTC

svn commit: r1373387 - /maven/indexer/trunk/indexer-core/src/main/java/org/apache/maven/index/DefaultScannerListener.java

Author: cstamas
Date: Wed Aug 15 13:16:23 2012
New Revision: 1373387

URL: http://svn.apache.org/viewvc?rev=1373387&view=rev
Log:
Getting rid of heap memory hog when unneeded.

DefaultScannerListener hold a Set<String> with all the existing
UINFOs loaded up in initialisation part of processing when
update was happening. The solely purpose of this set was, that
as last step, create diff with processed UINFOs and delete from index
the files not found while scanning but on index. This step makes sense
for contexts that does NOT receive updates from remote, as they are
actually "hosted" reposes (in MRM lingo). In case of "proxy" reposes,
if Indexer did not find a file locally, but is on index, it is
probably a file present on remote (proxied) repository, who's published
index was already downloaded once.

Also, the method removeDeletedArtifacts() making use of this set
was invoked with same condition as the building of set is now
enclosed.

Meaning, the potentially huge Set<String> will not be built anymore
unless really needed and used.

Modified:
    maven/indexer/trunk/indexer-core/src/main/java/org/apache/maven/index/DefaultScannerListener.java

Modified: maven/indexer/trunk/indexer-core/src/main/java/org/apache/maven/index/DefaultScannerListener.java
URL: http://svn.apache.org/viewvc/maven/indexer/trunk/indexer-core/src/main/java/org/apache/maven/index/DefaultScannerListener.java?rev=1373387&r1=1373386&r2=1373387&view=diff
==============================================================================
--- maven/indexer/trunk/indexer-core/src/main/java/org/apache/maven/index/DefaultScannerListener.java (original)
+++ maven/indexer/trunk/indexer-core/src/main/java/org/apache/maven/index/DefaultScannerListener.java Wed Aug 15 13:16:23 2012
@@ -223,7 +223,16 @@ class DefaultScannerListener
 
                     if ( uinfo != null )
                     {
-                        uinfos.add( uinfo );
+                        // if ctx is receiving updates (in other words, is a proxy),
+                        // there is no need to build a huge Set of strings with all uinfo's
+                        // as deletion detection in those cases have no effect. Also, the
+                        // removeDeletedArtifacts() method, that uses info gathered in this set
+                        // is invoked with same condition. As indexes of Central are getting huge,
+                        // the set grows enormously too, but is actually not used
+                        if ( !ctx.isReceivingUpdates() )
+                        {
+                            uinfos.add( uinfo );
+                        }
 
                         // add all existing groupIds to the lists, as they will
                         // not be "discovered" and would be missing from the new list..