Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
fix for http://www.yacy-forum.de/viewtopic.php?p=33925#33925
orbiter25070822a52c
diff --git a/source/de/anomic/kelondro/kelondroDyn.java b/source/de/anomic/kelondro/kelondroDyn.javaindex ebe428f67..f5d270e7b 100644--- a/source/de/anomic/kelondro/kelondroDyn.java+++ b/source/de/anomic/kelondro/kelondroDyn.java@@ -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();diff --git a/source/de/anomic/kelondro/kelondroFlexTable.java b/source/de/anomic/kelondro/kelondroFlexTable.javaindex 08b27cc44..ed640f211 100644--- a/source/de/anomic/kelondro/kelondroFlexTable.java+++ b/source/de/anomic/kelondro/kelondroFlexTable.java@@ -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 appliedsuper(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 kelondrSystem.out.println("*** Last Startup time: " + stt + " milliseconds");long start = System.currentTimeMillis();+if (serverMemory.available(neededRAM, true)) {// we can use a RAM indexdiff --git a/source/de/anomic/kelondro/kelondroFlexWidthArray.java b/source/de/anomic/kelondro/kelondroFlexWidthArray.javaindex c19faeeba..e60630524 100644--- a/source/de/anomic/kelondro/kelondroFlexWidthArray.java+++ b/source/de/anomic/kelondro/kelondroFlexWidthArray.java@@ -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 normaldiff --git a/source/de/anomic/yacy/yacySeedDB.java b/source/de/anomic/yacy/yacySeedDB.javaindex 10d7ba459..a75a24068 100644--- a/source/de/anomic/yacy/yacySeedDB.java+++ b/source/de/anomic/yacy/yacySeedDB.java@@ -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);}}