fixed bugs in last commit

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@65 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 20 years ago
parent 9cb8779208
commit 9156fd53bc

@ -104,7 +104,7 @@ public final class plasmaCrawlWorker extends Thread {
this.log = log; this.log = log;
} }
public void execute(plasmaCrawlLoaderMessage theMsg) { public synchronized void execute(plasmaCrawlLoaderMessage theMsg) {
this.theMsg = theMsg; this.theMsg = theMsg;
this.url = theMsg.url; this.url = theMsg.url;

@ -301,10 +301,15 @@ public class plasmaSearch {
Enumeration e = searchResult.elements(true); Enumeration e = searchResult.elements(true);
plasmaWordIndexEntry entry; plasmaWordIndexEntry entry;
long startCreateTime = System.currentTimeMillis(); long startCreateTime = System.currentTimeMillis();
while ((e.hasMoreElements()) && try {
((acc.sizeFetched() < minEntries) || (System.currentTimeMillis() - startCreateTime < maxTime))) { while ((e.hasMoreElements()) &&
entry = (plasmaWordIndexEntry) e.nextElement(); ((acc.sizeFetched() < minEntries) || (System.currentTimeMillis() - startCreateTime < maxTime))) {
acc.addResult(entry); 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(); long startSortTime = System.currentTimeMillis();
acc.sortResults(); acc.sortResults();

@ -116,7 +116,7 @@ public class plasmaSwitchboard extends serverAbstractSwitch implements serverSwi
// load slots // load slots
private static final int crawlSlots = 6; private static final int crawlSlots = 8;
// couloured list management // couloured list management
public static TreeSet blueList = null; public static TreeSet blueList = null;
@ -411,19 +411,17 @@ public class plasmaSwitchboard extends serverAbstractSwitch implements serverSwi
public boolean deQueue() { public boolean deQueue() {
// work off fresh entries from the proxy or from the crawler // work off fresh entries from the proxy or from the crawler
synchronized (processStack) { if (processStack.size() == 0) return false; // nothing to do
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
// 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) {}
if (serverJobs > 10) try {Thread.currentThread().sleep(10 * serverJobs);} catch (InterruptedException e) {}
// do one processing step
// do one processing step log.logDebug("DEQUEUE: serverJobs=" + serverJobs +
log.logDebug("DEQUEUE: serverJobs=" + serverJobs + ", processStack=" + processStack.size() +
", processStack=" + processStack.size() + ", localStackSize=" + noticeURL.localStackSize() +
", localStackSize=" + noticeURL.localStackSize() + ", remoteStackSize=" + noticeURL.remoteStackSize());
", remoteStackSize=" + noticeURL.remoteStackSize()); processResourceStack((plasmaHTCache.Entry) processStack.removeFirst());
processResourceStack((plasmaHTCache.Entry) processStack.removeFirst());
}
return true; return true;
} }

@ -171,15 +171,15 @@ public class plasmaWordIndexRAMCache extends Thread {
return flushKey(key, "flushSpecific"); return flushKey(key, "flushSpecific");
} }
private synchronized int flushKey(String key, String caller) throws IOException { private int flushKey(String key, String caller) throws IOException {
Vector v = (Vector) cache.get(key); Vector v = null;
if (v == null) { synchronized (cache) {
//serverLog.logDebug("PLASMA INDEXING", "flushKey: '" + caller + "' forced to flush non-existing key " + key); v = (Vector) cache.get(key);
return 0; if (v == null) return 0; // flushing of nonexisting key
cache.remove(key);
hashScore.deleteScore(key);
} }
pic.addEntriesToIndex(key, v); pic.addEntriesToIndex(key, v);
cache.remove(key);
hashScore.deleteScore(key);
return v.size(); return v.size();
} }

Loading…
Cancel
Save