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;
}
public void execute(plasmaCrawlLoaderMessage theMsg) {
public synchronized void execute(plasmaCrawlLoaderMessage theMsg) {
this.theMsg = theMsg;
this.url = theMsg.url;

@ -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();

@ -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;
}

@ -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();
}

Loading…
Cancel
Save