Skip to content

Commit

Permalink
Enabled "isEnabled" feature in DeDuplicator.
Browse files Browse the repository at this point in the history
  • Loading branch information
csrster committed Nov 24, 2016
1 parent 95eeb7f commit 6dda348
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@
@SuppressWarnings({"unchecked"})
public class DeDuplicator extends Processor implements InitializingBean {

@Override public boolean getEnabled() {
return super.getEnabled();
}

@Override public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
}

private static Logger logger =
Logger.getLogger(DeDuplicator.class.getName());

Expand Down Expand Up @@ -351,6 +359,10 @@ public void setServerCache(ServerCache serverCache) {


public void afterPropertiesSet() throws Exception {
if (!getEnabled()) {
logger.info(this.getClass().getName() + " disabled.");
return;
}
// Index location
String indexLocation = getIndexLocation();
try {
Expand Down Expand Up @@ -393,6 +405,10 @@ public void afterPropertiesSet() throws Exception {

@Override
protected boolean shouldProcess(CrawlURI curi) {
if (!getEnabled()) {
logger.finest("Not handling " + curi.toString() + ", deduplication disabled.");
return false;
}
if (curi.isSuccess() == false) {
// Early return. No point in doing comparison on failed downloads.
logger.finest("Not handling " + curi.toString()
Expand Down Expand Up @@ -472,6 +488,7 @@ private String getRefersToDate(Document duplicate) {

@Override
protected ProcessResult innerProcessResult(CrawlURI curi) throws InterruptedException {

ProcessResult processResult = ProcessResult.PROCEED; // Default. Continue as normal

logger.finest("Processing " + curi.toString() + "(" +
Expand Down

0 comments on commit 6dda348

Please sign in to comment.