Author: ferdy
Date: Tue Jul 10 14:26:23 2012
New Revision: 1359697

URL: http://svn.apache.org/viewvc?rev=1359697&view=rev
Log:
NUTCH-1427 Reuse SelectorEntry in Generator.

Modified:
    nutch/branches/2.x/CHANGES.txt
    nutch/branches/2.x/src/java/org/apache/nutch/crawl/GeneratorJob.java
    nutch/branches/2.x/src/java/org/apache/nutch/crawl/GeneratorMapper.java

Modified: nutch/branches/2.x/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/nutch/branches/2.x/CHANGES.txt?rev=1359697&r1=1359696&r2=1359697&view=diff
==============================================================================
--- nutch/branches/2.x/CHANGES.txt (original)
+++ nutch/branches/2.x/CHANGES.txt Tue Jul 10 14:26:23 2012
@@ -1,6 +1,7 @@
 Nutch Change Log
 
 Release 2.1 - Current Development
+* NUTCH-1427 Reuse SelectorEntry in Generator. (ferdy)
 
 * NUTCH-1411 nutchgora fetcher.store.content does not work (Alexander Kingson 
via ferdy) 
 

Modified: nutch/branches/2.x/src/java/org/apache/nutch/crawl/GeneratorJob.java
URL: 
http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/crawl/GeneratorJob.java?rev=1359697&r1=1359696&r2=1359697&view=diff
==============================================================================
--- nutch/branches/2.x/src/java/org/apache/nutch/crawl/GeneratorJob.java 
(original)
+++ nutch/branches/2.x/src/java/org/apache/nutch/crawl/GeneratorJob.java Tue 
Jul 10 14:26:23 2012
@@ -118,6 +118,17 @@ public class GeneratorJob extends NutchT
         return false;
       return true;
     }
+               
+    /**
+     * Sets url with score on this writable. Allows for writable reusing.
+     * 
+     * @param url
+     * @param score
+     */
+    public void set(String url, float score) {
+      this.url=url;
+      this.score=score;
+    }
   }
 
   public static class SelectorEntryComparator extends WritableComparator {

Modified: 
nutch/branches/2.x/src/java/org/apache/nutch/crawl/GeneratorMapper.java
URL: 
http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/crawl/GeneratorMapper.java?rev=1359697&r1=1359696&r2=1359697&view=diff
==============================================================================
--- nutch/branches/2.x/src/java/org/apache/nutch/crawl/GeneratorMapper.java 
(original)
+++ nutch/branches/2.x/src/java/org/apache/nutch/crawl/GeneratorMapper.java Tue 
Jul 10 14:26:23 2012
@@ -41,6 +41,7 @@ extends GoraMapper<String, WebPage, Sele
   private FetchSchedule schedule;
   private ScoringFilters scoringFilters;
   private long curTime;
+  private SelectorEntry entry = new SelectorEntry();
 
   @Override
   public void map(String reversedUrl, WebPage page,
@@ -87,7 +88,7 @@ extends GoraMapper<String, WebPage, Sele
     } catch (ScoringFilterException e) {
       //ignore
     }
-    SelectorEntry entry = new SelectorEntry(url, score);
+    entry.set(url, score);
     context.write(entry, page);
   }
 


Reply via email to