diff --git a/source/de/anomic/plasma/plasmaCrawlWorker.java b/source/de/anomic/plasma/plasmaCrawlWorker.java index 74be6fb14..fbe38eef8 100644 --- a/source/de/anomic/plasma/plasmaCrawlWorker.java +++ b/source/de/anomic/plasma/plasmaCrawlWorker.java @@ -104,7 +104,7 @@ public final class plasmaCrawlWorker extends Thread { this.log = log; } - public void execute(plasmaCrawlLoaderMessage theMsg) { + public synchronized void execute(plasmaCrawlLoaderMessage theMsg) { this.theMsg = theMsg; this.url = theMsg.url; diff --git a/source/de/anomic/plasma/plasmaSearch.java b/source/de/anomic/plasma/plasmaSearch.java index b8fa12748..9f06370ed 100644 --- a/source/de/anomic/plasma/plasmaSearch.java +++ b/source/de/anomic/plasma/plasmaSearch.java @@ -301,10 +301,15 @@ public class plasmaSearch { Enumeration e = searchResult.elements(true); plasmaWordIndexEntry entry; long startCreateTime = System.currentTimeMillis(); - while ((e.hasMoreElements()) && - ((acc.sizeFetched() < minEntries) || (System.currentTimeMillis() - startCreateTime < maxTime))) { - entry = (plasmaWordIndexEntry) e.nextElement(); - acc.addResult(entry); + try { + while ((e.hasMoreElements()) && + ((acc.sizeFetched() < minEntries) || (System.currentTimeMillis() - startCreateTime < maxTime))) { + entry = (plasmaWordIndexEntry) e.nextElement(); + acc.addResult(entry); + } + } catch (kelondroException ee) { + serverLog.logError("PLASMA", "Database Failure during plasmaSearch.order: " + ee.getMessage()); + ee.printStackTrace(); } long startSortTime = System.currentTimeMillis(); acc.sortResults(); diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.java index 76a3775d4..f6ab7987d 100644 --- a/source/de/anomic/plasma/plasmaSwitchboard.java +++ b/source/de/anomic/plasma/plasmaSwitchboard.java @@ -116,7 +116,7 @@ public class plasmaSwitchboard extends serverAbstractSwitch implements serverSwi // load slots - private static final int crawlSlots = 6; + private static final int crawlSlots = 8; // couloured list management public static TreeSet blueList = null; @@ -411,19 +411,17 @@ public class plasmaSwitchboard extends serverAbstractSwitch implements serverSwi public boolean deQueue() { // work off fresh entries from the proxy or from the crawler - synchronized (processStack) { - if (processStack.size() == 0) return false; // noting to do - - // in case that the server is very busy we do not work off the queue too fast - if (serverJobs > 10) try {Thread.currentThread().sleep(10 * serverJobs);} catch (InterruptedException e) {} - - // do one processing step - log.logDebug("DEQUEUE: serverJobs=" + serverJobs + - ", processStack=" + processStack.size() + - ", localStackSize=" + noticeURL.localStackSize() + - ", remoteStackSize=" + noticeURL.remoteStackSize()); - processResourceStack((plasmaHTCache.Entry) processStack.removeFirst()); - } + if (processStack.size() == 0) return false; // nothing to do + + // in case that the server is very busy we do not work off the queue too fast + if (serverJobs > 10) try {Thread.currentThread().sleep(10 * serverJobs);} catch (InterruptedException e) {} + + // do one processing step + log.logDebug("DEQUEUE: serverJobs=" + serverJobs + + ", processStack=" + processStack.size() + + ", localStackSize=" + noticeURL.localStackSize() + + ", remoteStackSize=" + noticeURL.remoteStackSize()); + processResourceStack((plasmaHTCache.Entry) processStack.removeFirst()); return true; } diff --git a/source/de/anomic/plasma/plasmaWordIndexRAMCache.java b/source/de/anomic/plasma/plasmaWordIndexRAMCache.java index 36c93f33d..77245d015 100644 --- a/source/de/anomic/plasma/plasmaWordIndexRAMCache.java +++ b/source/de/anomic/plasma/plasmaWordIndexRAMCache.java @@ -171,15 +171,15 @@ public class plasmaWordIndexRAMCache extends Thread { return flushKey(key, "flushSpecific"); } - private synchronized int flushKey(String key, String caller) throws IOException { - Vector v = (Vector) cache.get(key); - if (v == null) { - //serverLog.logDebug("PLASMA INDEXING", "flushKey: '" + caller + "' forced to flush non-existing key " + key); - return 0; + private int flushKey(String key, String caller) throws IOException { + Vector v = null; + synchronized (cache) { + v = (Vector) cache.get(key); + if (v == null) return 0; // flushing of nonexisting key + cache.remove(key); + hashScore.deleteScore(key); } pic.addEntriesToIndex(key, v); - cache.remove(key); - hashScore.deleteScore(key); return v.size(); }