Apache Nutch is an extensible and scalable web crawler
Do some math and format some stuff.
Kenneth McFarland02f789c7d1c6
diff --git a/src/java/org/apache/nutch/crawl/AbstractFetchSchedule.java b/src/java/org/apache/nutch/crawl/AbstractFetchSchedule.javaindex 0e4eafa06..38fde9f02 100755--- a/src/java/org/apache/nutch/crawl/AbstractFetchSchedule.java+++ b/src/java/org/apache/nutch/crawl/AbstractFetchSchedule.java@@ -17,13 +17,14 @@package org.apache.nutch.crawl;-import org.slf4j.Logger;-import org.slf4j.LoggerFactory;import org.apache.hadoop.conf.Configuration;import org.apache.hadoop.conf.Configured;import org.apache.hadoop.io.Text;import org.apache.nutch.crawl.CrawlDatum;+import org.slf4j.Logger;+import org.slf4j.LoggerFactory;+import java.lang.invoke.MethodHandles;/**@@ -184,8 +185,8 @@ public abstract class AbstractFetchSchedule extends Configured implements*/public boolean shouldFetch(Text url, CrawlDatum datum, long curTime) {// pages are never truly GONE - we have to check them from time to time.- // pages with too long fetchInterval are adjusted so that they fit within- // maximum fetchInterval (segment retention period).+ // pages with too long a fetchInterval are adjusted so that they fit within+ // a maximum fetchInterval (segment retention period).if (datum.getFetchTime() - curTime > (long) maxInterval * 1000) {if (datum.getFetchInterval() > maxInterval) {datum.setFetchInterval(maxInterval * 0.9f);diff --git a/src/java/org/apache/nutch/crawl/CrawlDatum.java b/src/java/org/apache/nutch/crawl/CrawlDatum.javaindex 4057c4d38..b9d4cab26 100644--- a/src/java/org/apache/nutch/crawl/CrawlDatum.java+++ b/src/java/org/apache/nutch/crawl/CrawlDatum.java@@ -331,8 +331,8 @@ public class CrawlDatum implements WritableComparable<CrawlDatum>, Cloneable {}/** The number of bytes into a CrawlDatum that the score is stored. */- private static final int SCORE_OFFSET = 1 + 1 + 8 + 1 + 4;- private static final int SIG_OFFSET = SCORE_OFFSET + 4 + 8;+ private static final int SCORE_OFFSET = 15;+ private static final int SIG_OFFSET = SCORE_OFFSET + 12;public void write(DataOutput out) throws IOException {out.writeByte(CUR_VERSION); // store current version@@ -412,16 +412,16 @@ public class CrawlDatum implements WritableComparable<CrawlDatum>, Cloneable {int status2 = b2[s2 + 1];if (status2 != status1)return status1 - status2;- long fetchTime1 = readLong(b1, s1 + 1 + 1);- long fetchTime2 = readLong(b2, s2 + 1 + 1);+ long fetchTime1 = readLong(b1, s1 + 2);+ long fetchTime2 = readLong(b2, s2 + 2);if (fetchTime2 != fetchTime1)return (fetchTime2 - fetchTime1) > 0 ? 1 : -1;- int retries1 = b1[s1 + 1 + 1 + 8];- int retries2 = b2[s2 + 1 + 1 + 8];+ int retries1 = b1[s1 + 10];+ int retries2 = b2[s2 + 10];if (retries2 != retries1)return retries2 - retries1;- int fetchInterval1 = readInt(b1, s1 + 1 + 1 + 8 + 1);- int fetchInterval2 = readInt(b2, s2 + 1 + 1 + 8 + 1);+ int fetchInterval1 = readInt(b1, s1 + 11);+ int fetchInterval2 = readInt(b2, s2 + 11);if (fetchInterval2 != fetchInterval1)return (fetchInterval2 - fetchInterval1) > 0 ? 1 : -1;long modifiedTime1 = readLong(b1, s1 + SCORE_OFFSET + 4);@@ -569,4 +569,4 @@ public class CrawlDatum implements WritableComparable<CrawlDatum>, Cloneable {return false;}-}\ No newline at end of file+}