Skip to content

Commit

Permalink
fixed bugs in last commit
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@65 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Apr 26, 2005
1 parent 9cb8779 commit 9156fd5
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 26 deletions.
2 changes: 1 addition & 1 deletion source/de/anomic/plasma/plasmaCrawlWorker.java
Expand Up @@ -104,7 +104,7 @@ public plasmaCrawlWorker(
this.log = log;
}

public void execute(plasmaCrawlLoaderMessage theMsg) {
public synchronized void execute(plasmaCrawlLoaderMessage theMsg) {
this.theMsg = theMsg;

this.url = theMsg.url;
Expand Down
13 changes: 9 additions & 4 deletions source/de/anomic/plasma/plasmaSearch.java
Expand Up @@ -301,10 +301,15 @@ public plasmaSearch.result order(plasmaWordIndexEntity searchResult, Set searchh
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();
Expand Down
26 changes: 12 additions & 14 deletions source/de/anomic/plasma/plasmaSwitchboard.java
Expand Up @@ -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;
Expand Down Expand Up @@ -411,19 +411,17 @@ public void enQueue(Object job) {
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;
}

Expand Down
14 changes: 7 additions & 7 deletions source/de/anomic/plasma/plasmaWordIndexRAMCache.java
Expand Up @@ -171,15 +171,15 @@ private int flushSpecific(boolean greatest) throws IOException {
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();
}

Expand Down

0 comments on commit 9156fd5

Please sign in to comment.