From 676e384b45ce07887f5afe321732c9aedc1d949a Mon Sep 17 00:00:00 2001 From: orbiter Date: Tue, 13 Dec 2005 11:58:55 +0000 Subject: [PATCH] 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 --- source/de/anomic/kelondro/kelondroTree.java | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/source/de/anomic/kelondro/kelondroTree.java b/source/de/anomic/kelondro/kelondroTree.java index c11e34e06..97c09f486 100644 --- a/source/de/anomic/kelondro/kelondroTree.java +++ b/source/de/anomic/kelondro/kelondroTree.java @@ -149,15 +149,16 @@ public class kelondroTree extends kelondroRecords implements Comparator, kelondr public byte[][] get(byte[] key) throws IOException { // System.out.println("kelondroTree.get " + new String(key) + " in " + filename); byte[][] result = null; - //writeLock.stay(2000, 1000); - Search search = new Search(); - search.process(key); - if (search.found()) { - result = search.getMatcher().getValues(); - } else { - result = null; + // writeLock.stay(2000, 1000); + synchronized (writeSearchObj) { + writeSearchObj.process(key); + if (writeSearchObj.found()) { + result = writeSearchObj.getMatcher().getValues(); + } else { + result = null; + } } - //writeLock.release(); + // writeLock.release(); return result; } @@ -318,7 +319,7 @@ public class kelondroTree extends kelondroRecords implements Comparator, kelondr 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][]; newrow[0] = key; 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 - public synchronized byte[] put(byte[] key, byte[] value) throws IOException { + public byte[] put(byte[] key, byte[] value) throws IOException { byte[][] row = new byte[2][]; row[0] = key; row[1] = value;