Apache Nutch is an extensible and scalable web crawler
NUTCH-2597: fixed cleanup()
Jurian Broertjes4a69dbca2d62
diff --git a/src/java/org/apache/nutch/hostdb/UpdateHostDbReducer.java b/src/java/org/apache/nutch/hostdb/UpdateHostDbReducer.javaindex 21c847db8..70ce3eb3d 100644--- a/src/java/org/apache/nutch/hostdb/UpdateHostDbReducer.java+++ b/src/java/org/apache/nutch/hostdb/UpdateHostDbReducer.java@@ -74,6 +74,7 @@ public class UpdateHostDbReducer** @param job*/+ @Overridepublic void setup(Reducer<Text, NutchWritable, Text, HostDatum>.Context context) {Configuration conf = context.getConfiguration();purgeFailedHostsThreshold = conf.getInt(UpdateHostDb.HOSTDB_PURGE_FAILED_HOSTS_THRESHOLD, -1);@@ -113,6 +114,7 @@ public class UpdateHostDbReducer/****/+ @Overridepublic void reduce(Text key, Iterable<NutchWritable> values,Context context) throws IOException, InterruptedException {@@ -401,7 +403,8 @@ public class UpdateHostDbReducer/*** Shut down all running threads and wait for completion.*/- public void cleanup() {+ @Override+ public void cleanup(Context context) {LOG.info("UpdateHostDb: feeder finished, waiting for shutdown");// If we're here all keys have been fed and we can issue a shut downdiff --git a/src/java/org/apache/nutch/indexer/CleaningJob.java b/src/java/org/apache/nutch/indexer/CleaningJob.javaindex e8dab4031..74a6803a6 100644--- a/src/java/org/apache/nutch/indexer/CleaningJob.java+++ b/src/java/org/apache/nutch/indexer/CleaningJob.java@@ -64,10 +64,12 @@ public class CleaningJob implements Tool {Mapper<Text, CrawlDatum, ByteWritable, Text> {private ByteWritable OUT = new ByteWritable(CrawlDatum.STATUS_DB_GONE);+ @Overridepublic void setup(Mapper<Text, CrawlDatum, ByteWritable, Text>.Context context) {}- public void cleanup() throws IOException {+ @Override+ public void cleanup(Context context) throws IOException {}@Override@@ -91,6 +93,7 @@ public class CleaningJob implements Tool {IndexWriters writers = null;+ @Overridepublic void setup(Reducer<ByteWritable, Text, Text, ByteWritable>.Context context) {Configuration conf = context.getConfiguration();writers = IndexWriters.get(conf);@@ -102,7 +105,8 @@ public class CleaningJob implements Tool {noCommit = conf.getBoolean("noCommit", false);}- public void cleanup() throws IOException {+ @Override+ public void cleanup(Context context) throws IOException {// BUFFERING OF CALLS TO INDEXER SHOULD BE HANDLED AT INDEXER LEVEL// if (numDeletes > 0) {// LOG.info("CleaningJob: deleting " + numDeletes + " documents");@@ -119,6 +123,7 @@ public class CleaningJob implements Tool {LOG.info("CleaningJob: deleted a total of " + totalDeleted + " documents");}+ @Overridepublic void reduce(ByteWritable key, Iterable<Text> values,Context context) throws IOException {for (Text document : values) {