Author: orbiter Date: 2008-02-02 22:36:19 +0100 (Sat, 02 Feb 2008) New Revision: 4429
Modified: trunk/htroot/LogStatistics_p.java trunk/source/de/anomic/kelondro/kelondroBufferedEcoFS.java trunk/source/de/anomic/kelondro/kelondroEcoFS.java trunk/source/de/anomic/kelondro/kelondroEcoTable.java Log: tried to fix another eco bug Modified: trunk/htroot/LogStatistics_p.java =================================================================== --- trunk/htroot/LogStatistics_p.java 2008-02-02 11:30:47 UTC (rev 4428) +++ trunk/htroot/LogStatistics_p.java 2008-02-02 21:36:19 UTC (rev 4429) @@ -60,7 +60,7 @@ private static final String RESULTS = "results_"; - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "boxing" }) public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) { final serverObjects prop = new serverObjects(); @@ -89,7 +89,7 @@ prop.put("results", "1"); String[] t; float l; - prop.put(RESULTS + LogParserPLASMA.DHT_DISTANCE_AVERAGE, (String) r.get(LogParserPLASMA.DHT_DISTANCE_AVERAGE)); + prop.put(RESULTS + LogParserPLASMA.DHT_DISTANCE_AVERAGE, (Double) r.get(LogParserPLASMA.DHT_DISTANCE_AVERAGE)); prop.put(RESULTS + LogParserPLASMA.DHT_DISTANCE_MAX, (String) r.get(LogParserPLASMA.DHT_DISTANCE_MAX)); prop.put(RESULTS + LogParserPLASMA.DHT_DISTANCE_MIN, (String) r.get(LogParserPLASMA.DHT_DISTANCE_MIN)); prop.put(RESULTS + LogParserPLASMA.DHT_REJECTED, (String) r.get(LogParserPLASMA.DHT_REJECTED)); Modified: trunk/source/de/anomic/kelondro/kelondroBufferedEcoFS.java =================================================================== --- trunk/source/de/anomic/kelondro/kelondroBufferedEcoFS.java 2008-02-02 11:30:47 UTC (rev 4428) +++ trunk/source/de/anomic/kelondro/kelondroBufferedEcoFS.java 2008-02-02 21:36:19 UTC (rev 4429) @@ -93,7 +93,7 @@ public synchronized void put(long index, byte[] b, int start) throws IOException { assert b.length - start >= efs.recordsize; - if (index > size()) throw new IndexOutOfBoundsException("kelondroEcoFS.put(" + index + ") outside bounds (" + this.size() + ")"); + if (index > size()) throw new IndexOutOfBoundsException("kelondroBufferedEcoFS.put(" + index + ") outside bounds (" + this.size() + ")"); if (index == efs.size()) { efs.put(index, b, start); } else { @@ -107,7 +107,7 @@ public synchronized void add(byte[] b, int start) throws IOException { put(size(), b, start); } - +/* public synchronized void clean(long index, byte[] b, int start) throws IOException { assert b.length - start >= efs.recordsize; if (index >= size()) throw new IndexOutOfBoundsException("kelondroBufferedEcoFS.clean(" + index + ") outside bounds (" + this.size() + ")"); @@ -126,24 +126,23 @@ buffer.remove(new Long(index)); efs.clean(index); } - +*/ public synchronized void cleanLast(byte[] b, int start) throws IOException { assert b.length - start >= efs.recordsize; Long i = new Long(size() - 1); - byte[] bb = buffer.get(i); + byte[] bb = buffer.remove(i); if (bb == null) { - efs.clean(i.intValue(), b, start); + efs.cleanLast(b, start); } else { System.arraycopy(bb, 0, b, start, efs.recordsize); - buffer.remove(i); - efs.clean(i.intValue()); + efs.cleanLast(); } } public synchronized void cleanLast() throws IOException { Long i = new Long(size() - 1); buffer.remove(i); - efs.clean(i.intValue()); + efs.cleanLast(); } } Modified: trunk/source/de/anomic/kelondro/kelondroEcoFS.java =================================================================== --- trunk/source/de/anomic/kelondro/kelondroEcoFS.java 2008-02-02 11:30:47 UTC (rev 4428) +++ trunk/source/de/anomic/kelondro/kelondroEcoFS.java 2008-02-02 21:36:19 UTC (rev 4429) @@ -225,10 +225,12 @@ assert b.length - start >= this.recordsize; if (index > size()) throw new IndexOutOfBoundsException("kelondroEcoFS.put(" + index + ") outside bounds (" + this.size() + ")"); // check if this is an empty entry + /* if (isClean(b , start, this.recordsize)) { clean(index); return; } + */ // check if index is inside of cache int p = inCache(index); int q = (p >= 0) ? -1 : inBuffer(index); @@ -304,7 +306,7 @@ assert false; return false; } - + /* public synchronized void clean(long index, byte[] b, int start) throws IOException { // removes an entry by cleaning (writing zero bytes to the file) // the entry that had been at the specific place before is copied to the given array b @@ -376,7 +378,7 @@ raf.seek((long) index * (long) this.recordsize); raf.write(zero, 0, this.recordsize); } - + */ public synchronized void cleanLast(byte[] b, int start) throws IOException { cleanLast0(b, start); long i; @@ -472,7 +474,7 @@ t.add("=======2".getBytes(), 0); t.cleanLast(b, 0); System.out.println(new String(b)); - t.clean(2, b, 0); + //t.clean(2, b, 0); System.out.println(new String(b)); t.get(1, b, 0); System.out.println(new String(b)); @@ -484,7 +486,7 @@ t.get(4, b, 0); System.out.println(new String(b)); System.out.println("size = " + t.size()); - t.clean(t.size() - 2); + //t.clean(t.size() - 2); t.cleanLast(); long start = System.currentTimeMillis(); long c = 0; Modified: trunk/source/de/anomic/kelondro/kelondroEcoTable.java =================================================================== --- trunk/source/de/anomic/kelondro/kelondroEcoTable.java 2008-02-02 11:30:47 UTC (rev 4428) +++ trunk/source/de/anomic/kelondro/kelondroEcoTable.java 2008-02-02 21:36:19 UTC (rev 4429) @@ -375,7 +375,7 @@ byte[] p = new byte[rowdef.objectsize]; if (table == null) { if (i == index.size() - 1) { - file.clean(i); + file.cleanLast(); } else { file.cleanLast(p, 0); file.put(i, p, 0); @@ -387,7 +387,7 @@ if (i == index.size() - 1) { // special handling if the entry is the last entry in the file table.removeRow(i, false); - file.clean(i); + file.cleanLast(); } else { // switch values kelondroRow.Entry te = table.removeOne(); @@ -413,12 +413,17 @@ byte[] b = new byte[rowdef.objectsize]; byte[] p = new byte[rowdef.objectsize]; int sb = index.size(); + int ix; + assert i < index.size(); if (table == null) { if (i == index.size() - 1) { - index.removei(key); - file.clean(i, b, 0); + ix = index.removei(key); + assert ix == i; + file.cleanLast(b, 0); } else { - index.removei(key); + assert i < index.size() - 1; + ix = index.removei(key); + assert ix == i; file.get(i, b, 0); file.cleanLast(p, 0); file.put(i, p, 0); @@ -437,7 +442,7 @@ // special handling if the entry is the last entry in the file index.removei(key); table.removeRow(i, false); - file.clean(i); + file.cleanLast(); } else { // switch values index.removei(key); _______________________________________________ YaCy-svn mailing list YaCy-svn@lists.berlios.de https://lists.berlios.de/mailman/listinfo/yacy-svn