Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
fix for http://forum.yacy-websuche.de/viewtopic.php?f=6&t=171
orbitere7a99d765e37
diff --git a/htroot/News.java b/htroot/News.javaindex 8f3ef766d..fa4cea787 100644--- a/htroot/News.java+++ b/htroot/News.java@@ -93,15 +93,11 @@ public class News {prop.put("AUTHENTICATE", "admin log-in");return prop; // this button needs authentication, force log-in}- yacyNewsRecord record;try {if ((tableID == yacyNewsPool.PROCESSED_DB) || (tableID == yacyNewsPool.PUBLISHED_DB)) {yacyCore.newsPool.clear(tableID);} else {- while (yacyCore.newsPool.size(tableID) > 0) {- record = (yacyNewsRecord) yacyCore.newsPool.recordIterator(tableID, true).next();- yacyCore.newsPool.moveOff(tableID, record.id());- }+ yacyCore.newsPool.moveOffAll(tableID);}} catch (IOException e) {e.printStackTrace();diff --git a/source/de/anomic/yacy/yacyNewsPool.java b/source/de/anomic/yacy/yacyNewsPool.javaindex 3b222c77f..9a5a5a44c 100644--- a/source/de/anomic/yacy/yacyNewsPool.java+++ b/source/de/anomic/yacy/yacyNewsPool.java@@ -478,20 +478,41 @@ public class yacyNewsPool {// called if a published news shall be removedyacyNewsRecord record = fromqueue.remove(id);if (record == null) {- //System.out.println("DEBUG: record == null");return false;}- if (toqueue != null) toqueue.push(record);- else if ((incomingNews.get(id) == null) && (processedNews.get(id) == null) && (outgoingNews.get(id) == null) && (publishedNews.get(id) == null)){+ if (toqueue != null) {+ toqueue.push(record);+ } else if ((incomingNews.get(id) == null) && (processedNews.get(id) == null) && (outgoingNews.get(id) == null) && (publishedNews.get(id) == null)) {newsDB.remove(id);- //System.out.println("DEBUG: News-ID " + id + " deleted");}- //if (incomingNews.get(id) != null) System.out.println("DEBUG: News-ID " + id + " in incomingNews");- //if (processedNews.get(id) != null) System.out.println("DEBUG: News-ID " + id + " in processedNews");- //if (outgoingNews.get(id) != null) System.out.println("DEBUG: News-ID " + id + " in outgoingNews");- //if (publishedNews.get(id) != null) System.out.println("DEBUG: News-ID " + id + " in publishedNews");return true;}+ public void moveOffAll(int dbKey) throws IOException {+ // this is called if a queue element shall be moved to another queue or off the queue+ // it depends on the dbKey how the record is handled+ switch (dbKey) {+ case INCOMING_DB: moveOffAll(incomingNews, processedNews); break;+ case PROCESSED_DB: processedNews.clear(); break;+ case OUTGOING_DB: moveOffAll(outgoingNews, publishedNews); break;+ case PUBLISHED_DB: publishedNews.clear(); break;+ }+ }++ private int moveOffAll(yacyNewsQueue fromqueue, yacyNewsQueue toqueue) throws IOException {+ // move off all news from a specific queue to another queue+ Iterator i = fromqueue.records(true);+ yacyNewsRecord record;+ if (toqueue == null) return 0;+ int c = 0;+ while (i.hasNext()) {+ record = (yacyNewsRecord) i.next();+ if (record == null) continue;+ toqueue.push(record);+ c++;+ }+ fromqueue.clear();+ return c;+ }}