Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
added more logging to EcoFS
orbiter6e36c156e808
diff --git a/source/de/anomic/kelondro/kelondroEcoFS.java b/source/de/anomic/kelondro/kelondroEcoFS.javaindex 4dcc769cb..898710548 100644--- a/source/de/anomic/kelondro/kelondroEcoFS.java+++ b/source/de/anomic/kelondro/kelondroEcoFS.java@@ -34,6 +34,8 @@ import java.io.IOException;import java.io.RandomAccessFile;import java.util.Iterator;+import de.anomic.server.logging.serverLog;+/*** The EcoFS is a flat file with records of fixed length. The file does not contain* any meta information and the first record starts right at file position 0@@ -528,8 +530,10 @@ public class kelondroEcoFS {public static class ChunkIterator implements Iterator<byte[]> {- private int recordsize, chunksize;+ private int recordsize, chunksize, chunkcounter;private DataInputStream stream;+ private serverLog log;+ private File file;/*** create a ChunkIterator@@ -540,12 +544,15 @@ public class kelondroEcoFS {* @param chunksize: the size of the chunks that are returned by next(). remaining bytes until the lenght of recordsize are skipped* @throws FileNotFoundException*/- public ChunkIterator(File file, int recordsize, int chunksize) throws FileNotFoundException {+ public ChunkIterator(File file, int recordsize, int chunksize, serverLog log) throws FileNotFoundException {assert (file.exists());assert file.length() % recordsize == 0;this.recordsize = recordsize;this.chunksize = chunksize;+ this.chunkcounter = 0; // only for loggingthis.stream = new DataInputStream(new BufferedInputStream(new FileInputStream(file), 64 * 1024));+ this.log = log;+ this.file = file;}public boolean hasNext() {@@ -570,7 +577,11 @@ public class kelondroEcoFS {}return chunk;} catch (IOException e) {- e.printStackTrace();+ if (log == null) {+ serverLog.logWarning("kelondroEcoFS", "ChunkIterator for file " + file.toString() + " ended with " + e.getCause().getMessage() + " at chunk " + this.chunkcounter, e);+ } else {+ log.logWarning("ChunkIterator for file " + file.toString() + " ended with " + e.getCause().getMessage() + " at chunk " + this.chunkcounter, e);+ }this.stream = null;return null;}diff --git a/source/de/anomic/kelondro/kelondroEcoTable.java b/source/de/anomic/kelondro/kelondroEcoTable.javaindex 9dd00e04b..b450e7800 100644--- a/source/de/anomic/kelondro/kelondroEcoTable.java+++ b/source/de/anomic/kelondro/kelondroEcoTable.java@@ -139,7 +139,7 @@ public class kelondroEcoTable implements kelondroIndex {} else {byte[] record;key = new byte[rowdef.primaryKeyLength];- Iterator<byte[]> ri = new kelondroEcoFS.ChunkIterator(tablefile, rowdef.objectsize, rowdef.objectsize);+ Iterator<byte[]> ri = new kelondroEcoFS.ChunkIterator(tablefile, rowdef.objectsize, rowdef.objectsize, null);while (ri.hasNext()) {record = ri.next();assert record != null;@@ -217,7 +217,7 @@ public class kelondroEcoTable implements kelondroIndex {*/public Iterator<byte[]> keyIterator(File file, kelondroRow rowdef) throws FileNotFoundException {assert rowdef.primaryKeyIndex == 0;- return new kelondroEcoFS.ChunkIterator(file, rowdef.objectsize, rowdef.primaryKeyLength);+ return new kelondroEcoFS.ChunkIterator(file, rowdef.objectsize, rowdef.primaryKeyLength, null);}public static long tableSize(File tablefile, int recordsize) {