fix for bugs in IODispatcher

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5921 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 16 years ago
parent 21fbca0410
commit 083533e5ec

@ -33,6 +33,7 @@ import java.util.Random;
import de.anomic.kelondro.order.Base64Order;
import de.anomic.kelondro.order.CloneableIterator;
import de.anomic.kelondro.order.NaturalOrder;
import de.anomic.kelondro.util.Log;
public class RowSet extends RowCollection implements ObjectIndex, Iterable<Row.Entry> {
@ -410,8 +411,20 @@ public class RowSet extends RowCollection implements ObjectIndex, Iterable<Row.E
protected static RowSet mergeEnum(RowCollection c0, RowCollection c1) {
assert c0.rowdef == c1.rowdef : c0.rowdef.toString() + " != " + c1.rowdef.toString();
RowSet r = new RowSet(c0.rowdef, c0.size() + c1.size());
c0.sort();
c1.sort();
try {
c0.sort();
} catch (Exception e) {
Log.logSevere("RowSet", "collection corrupted. cleaned. " + e.getMessage());
e.printStackTrace();
c0.clear();
}
try {
c1.sort();
} catch (Exception e) {
Log.logSevere("RowSet", "collection corrupted. cleaned. " + e.getMessage());
e.printStackTrace();
c1.clear();
}
int c0i = 0, c1i = 0;
int c0p, c1p;
int o;

@ -134,24 +134,36 @@ public class IODispatcher <ReferenceType extends Reference> extends Thread {
// prefer dump actions to flush memory to disc
if (dumpQueue.size() > 0) {
File f = null;
try {
dumpJob = dumpQueue.take();
f = dumpJob.file;
dumpJob.dump();
} catch (InterruptedException e) {
e.printStackTrace();
Log.logSevere("IODispatcher", "main run job was interrupted (1)", e);
e.printStackTrace();
} catch (Exception e) {
Log.logSevere("IODispatcher", "main run job had errors (1), dump to " + f + " failed.", e);
e.printStackTrace();
}
continue loop;
}
// otherwise do a merge operation
if (mergeQueue.size() > 0) {
File f = null, f1 = null, f2 = null;
try {
mergeJob = mergeQueue.take();
f = mergeJob.newFile;
f1 = mergeJob.f1;
f2 = mergeJob.f2;
mergeJob.merge();
} catch (InterruptedException e) {
e.printStackTrace();
Log.logSevere("IODispatcher", "main run job was interrupted (2)", e);
e.printStackTrace();
} catch (Exception e) {
Log.logSevere("IODispatcher", "main run job had errors (2), dump to " + f + " failed. Input files are " + f1 + " and " + f2, e);
e.printStackTrace();
}
continue loop;
}
@ -167,11 +179,11 @@ public class IODispatcher <ReferenceType extends Reference> extends Thread {
}
Log.logInfo("IODispatcher", "loop terminated");
} catch (InterruptedException e) {
e.printStackTrace();
Log.logSevere("IODispatcher", "main run job was interrupted (3)", e);
} catch (Exception e) {
e.printStackTrace();
} catch (Exception e) {
Log.logSevere("IODispatcher", "main run job failed (4)", e);
e.printStackTrace();
} finally {
Log.logInfo("IODispatcher", "terminating run job");
controlQueue = null;

@ -429,12 +429,6 @@ public final class plasmaWordIndex {
final int urlLength = url.toNormalform(true, true).length();
final int urlComps = htmlFilterContentScraper.urlComps(url.toString()).length;
// check if merger is running
if (this.merger != null && !this.merger.isAlive()) {
log.logSevere("re-starting IODispatcher");
this.merger.start();
}
// iterate over all words of context text
final Iterator<Map.Entry<String, Word>> i = condenser.words().entrySet().iterator();
Map.Entry<String, Word> wentry;

Loading…
Cancel
Save