orbiter 18 years ago
parent 06a7978730
commit 25070822a5

@ -109,6 +109,14 @@ public class kelondroDyn {
buffer = new kelondroObjectBuffer(file.toString());
}
public static final void delete(File file, boolean usetree) {
if (usetree) {
file.delete();
} else {
kelondroFlexTable.delete(file.getParentFile(), file.getName());
}
}
public void reset() throws IOException {
String name = this.index.filename();
this.index.reset();

@ -52,7 +52,14 @@ public class kelondroFlexTable extends kelondroFlexWidthArray implements kelondr
// if the ram is not sufficient, a tree file is generated
// if, and only if a tree file exists, the preload time is applied
super(path, tablename, rowdef, resetOnFail);
try {
if ((super.col[0].size() < 0) && (resetOnFail)) try {
super.reset();
} catch (IOException e2) {
e2.printStackTrace();
throw new kelondroException(e2.getMessage());
}
try {
long neededRAM = (long) ((super.row().column(0).cellwidth() + 4) * super.size() * kelondroRowCollection.growfactor);
File newpath = new File(path, tablename);
@ -65,6 +72,7 @@ public class kelondroFlexTable extends kelondroFlexWidthArray implements kelondr
System.out.println("*** Last Startup time: " + stt + " milliseconds");
long start = System.currentTimeMillis();
if (serverMemory.available(neededRAM, true)) {
// we can use a RAM index

@ -187,7 +187,7 @@ public class kelondroFlexWidthArray implements kelondroArray {
}
public void close() {
synchronized (col) {
if (col != null) synchronized (col) {
for (int i = 0; i < col.length; i++) {
if (col[i] != null) {
// a column can be null, this is normal

@ -173,6 +173,7 @@ public final class yacySeedDB {
}
private synchronized kelondroMapObjects openSeedTable(File seedDBFile) {
final boolean usetree = false;
new File(seedDBFile.getParent()).mkdirs();
Class[] args;
try {
@ -192,11 +193,11 @@ public final class yacySeedDB {
initializeHandlerMethod = null;
}
try {
return new kelondroMapObjects(new kelondroDyn(seedDBFile, true, true, preloadTime / 3, commonHashLength, 480, '#', false, false, true), 500, sortFields, longaccFields, doubleaccFields, initializeHandlerMethod, this);
return new kelondroMapObjects(new kelondroDyn(seedDBFile, true, true, preloadTime / 3, commonHashLength, 480, '#', usetree, false, true), 500, sortFields, longaccFields, doubleaccFields, initializeHandlerMethod, this);
} catch (Exception e) {
seedDBFile.delete();
// try again
return new kelondroMapObjects(new kelondroDyn(seedDBFile, true, true, preloadTime / 3, commonHashLength, 480, '#', false, false, true), 500, sortFields, longaccFields, doubleaccFields, initializeHandlerMethod, this);
kelondroDyn.delete(seedDBFile, usetree);
return new kelondroMapObjects(new kelondroDyn(seedDBFile, true, true, preloadTime / 3, commonHashLength, 480, '#', usetree, false, true), 500, sortFields, longaccFields, doubleaccFields, initializeHandlerMethod, this);
}
}

Loading…
Cancel
Save