From 4574fa4ce7ff7411ea5f579ac6cb18050b65d2e2 Mon Sep 17 00:00:00 2001 From: orbiter Date: Wed, 8 Jun 2005 15:28:29 +0000 Subject: [PATCH] bugfixes git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@224 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- .../de/anomic/plasma/plasmaSwitchboard.java | 40 ++++++++++--------- .../anomic/server/serverAbstractThread.java | 2 +- source/yacy.java | 1 + 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.java index dec9c3788..0ede5818d 100644 --- a/source/de/anomic/plasma/plasmaSwitchboard.java +++ b/source/de/anomic/plasma/plasmaSwitchboard.java @@ -334,7 +334,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser // deploy threads log.logSystem("Starting Threads"); - int indexing_cluster = Integer.parseInt(getConfig("?80_indexing_cluster", "1")); + int indexing_cluster = Integer.parseInt(getConfig("80_indexing_cluster", "1")); if (indexing_cluster < 1) indexing_cluster = 1; deployThread("90_cleanup", "Cleanup", "simple cleaning process for monitoring information" , new serverInstantThread(this, "cleanupJob", "cleanupJobSize"), 10000); // all 5 Minutes @@ -468,7 +468,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser public int totalSize() { return processStack.size() + cacheLoader.size() + noticeURL.stackSize(); } -*/ + */ public int queueSize() { return queueStack.size(); @@ -491,22 +491,26 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser public boolean deQueue() { // work off fresh entries from the proxy or from the crawler - if (queueStack.size() == 0) { - //log.logDebug("DEQUEUE: queue is empty"); - return false; // nothing to do - } - - // in case that the server is very busy we do not work off the queue too fast - if (!(cacheManager.idle())) try {Thread.currentThread().sleep(1000);} catch (InterruptedException e) {} - - // do one processing step - log.logDebug("DEQUEUE: cacheManager=" + ((cacheManager.idle()) ? "idle" : "busy") + - ", queueStack=" + queueStack.size() + - ", coreStackSize=" + noticeURL.coreStackSize() + - ", limitStackSize=" + noticeURL.limitStackSize() + - ", overhangStackSize=" + noticeURL.overhangStackSize() + - ", remoteStackSize=" + noticeURL.remoteStackSize()); - processResourceStack((plasmaHTCache.Entry) queueStack.removeFirst()); + plasmaHTCache.Entry nextentry; + synchronized (queueStack) { + if (queueStack.size() == 0) { + //log.logDebug("DEQUEUE: queue is empty"); + return false; // nothing to do + } + + // in case that the server is very busy we do not work off the queue too fast + if (!(cacheManager.idle())) try {Thread.currentThread().sleep(1000);} catch (InterruptedException e) {} + + // do one processing step + log.logDebug("DEQUEUE: cacheManager=" + ((cacheManager.idle()) ? "idle" : "busy") + + ", queueStack=" + queueStack.size() + + ", coreStackSize=" + noticeURL.coreStackSize() + + ", limitStackSize=" + noticeURL.limitStackSize() + + ", overhangStackSize=" + noticeURL.overhangStackSize() + + ", remoteStackSize=" + noticeURL.remoteStackSize()); + nextentry = (plasmaHTCache.Entry) queueStack.removeFirst(); + } + processResourceStack(nextentry); return true; } diff --git a/source/de/anomic/server/serverAbstractThread.java b/source/de/anomic/server/serverAbstractThread.java index ddee4469f..f3541ee91 100644 --- a/source/de/anomic/server/serverAbstractThread.java +++ b/source/de/anomic/server/serverAbstractThread.java @@ -195,7 +195,7 @@ public abstract class serverAbstractThread extends Thread implements serverThrea // do job timestamp = System.currentTimeMillis(); isBusy = this.job(); - busytime += System.currentTimeMillis() - timestamp; + busytime += (isBusy) ? System.currentTimeMillis() - timestamp : 0; // interrupt loop if this is supposed to be a one-time job if ((this.idlePause < 0) || (this.busyPause < 0)) break; // for one-time jobs // process scheduled pause diff --git a/source/yacy.java b/source/yacy.java index d18896368..a9461e515 100644 --- a/source/yacy.java +++ b/source/yacy.java @@ -275,6 +275,7 @@ public final class yacy { 30000 /*command max length incl. GET args*/, httpdLoglevel /*loglevel*/); server.setName("httpd:"+port); + server.setPriority(Thread.MAX_PRIORITY); if (server == null) { serverLog.logFailure("STARTUP", "Failed to start server. Probably port " + port + " already in use."); } else {