mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
tried to fix another eco bug
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4429 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
parent
08a12e9bb5
commit
cd3e0d6f03
|
@ -60,7 +60,7 @@ public class LogStatistics_p {
|
|||
|
||||
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 @@ public class LogStatistics_p {
|
|||
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));
|
||||
|
|
|
@ -93,7 +93,7 @@ public class kelondroBufferedEcoFS {
|
|||
|
||||
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 class kelondroBufferedEcoFS {
|
|||
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 @@ public class kelondroBufferedEcoFS {
|
|||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -225,10 +225,12 @@ public class kelondroEcoFS {
|
|||
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 @@ public class kelondroEcoFS {
|
|||
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 @@ public class kelondroEcoFS {
|
|||
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 @@ public class kelondroEcoFS {
|
|||
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 @@ public class kelondroEcoFS {
|
|||
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;
|
||||
|
|
|
@ -375,7 +375,7 @@ public class kelondroEcoTable implements kelondroIndex {
|
|||
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 @@ public class kelondroEcoTable implements kelondroIndex {
|
|||
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 @@ public class kelondroEcoTable implements kelondroIndex {
|
|||
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 @@ public class kelondroEcoTable implements kelondroIndex {
|
|||
// 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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user