1 25 package org.archive.crawler.datamodel; 26 27 import java.io.Serializable ; 28 29 import org.apache.commons.httpclient.HttpStatus; 30 31 38 public class CrawlSubstats implements Serializable , FetchStatusCodes { 39 40 private static final long serialVersionUID = 8624425657056569036L; 41 42 public interface HasCrawlSubstats { 43 public CrawlSubstats getSubstats(); 44 } 45 46 long fetchSuccesses; long fetchResponses; long successBytes; long totalBytes; long fetchNonResponses; 53 public synchronized void tally(CrawlURI curi) { 54 if(curi.getFetchStatus()<=0) { 55 fetchNonResponses++; 56 return; 57 } 58 fetchResponses++; 59 totalBytes += curi.getContentSize(); 60 if(curi.getFetchStatus()>=HttpStatus.SC_OK && 61 curi.getFetchStatus()<300) { 62 fetchSuccesses++; 63 successBytes += curi.getContentSize(); 64 } 65 } 66 67 public long getFetchSuccesses() { 68 return fetchSuccesses; 69 } 70 public long getFetchResponses() { 71 return fetchResponses; 72 } 73 public long getSuccessBytes() { 74 return successBytes; 75 } 76 public long getTotalBytes() { 77 return totalBytes; 78 } 79 public long getFetchNonResponses() { 80 return fetchNonResponses; 81 } 82 } 83 | Popular Tags |