changed synchronization to fix 'contains loops' bug in kelondroTree

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1208 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
orbiter 2005-12-13 11:58:55 +00:00
parent 5e2673e86c
commit 676e384b45

View File

@ -149,15 +149,16 @@ public class kelondroTree extends kelondroRecords implements Comparator, kelondr
public byte[][] get(byte[] key) throws IOException { public byte[][] get(byte[] key) throws IOException {
// System.out.println("kelondroTree.get " + new String(key) + " in " + filename); // System.out.println("kelondroTree.get " + new String(key) + " in " + filename);
byte[][] result = null; byte[][] result = null;
//writeLock.stay(2000, 1000); // writeLock.stay(2000, 1000);
Search search = new Search(); synchronized (writeSearchObj) {
search.process(key); writeSearchObj.process(key);
if (search.found()) { if (writeSearchObj.found()) {
result = search.getMatcher().getValues(); result = writeSearchObj.getMatcher().getValues();
} else { } else {
result = null; result = null;
}
} }
//writeLock.release(); // writeLock.release();
return result; return result;
} }
@ -318,7 +319,7 @@ public class kelondroTree extends kelondroRecords implements Comparator, kelondr
return (lc.equals(childn.handle())); return (lc.equals(childn.handle()));
} }
public synchronized long[] putLong(byte[] key, long[] newlongs) throws IOException { public long[] putLong(byte[] key, long[] newlongs) throws IOException {
byte[][] newrow = new byte[newlongs.length + 1][]; byte[][] newrow = new byte[newlongs.length + 1][];
newrow[0] = key; newrow[0] = key;
for (int i = 0; i < newlongs.length; i++) { for (int i = 0; i < newlongs.length; i++) {
@ -598,7 +599,7 @@ public class kelondroTree extends kelondroRecords implements Comparator, kelondr
} }
// Associates the specified value with the specified key in this map // Associates the specified value with the specified key in this map
public synchronized byte[] put(byte[] key, byte[] value) throws IOException { public byte[] put(byte[] key, byte[] value) throws IOException {
byte[][] row = new byte[2][]; byte[][] row = new byte[2][];
row[0] = key; row[0] = key;
row[1] = value; row[1] = value;