more strict BLOB initialization .. may also help to save some ram

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5776 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 16 years ago
parent 5b138ada16
commit ab656687d7

@ -155,7 +155,7 @@ public class BLOBArray implements BLOB {
d = DateFormatter.parseShortMilliSecond(files[i].substring(prefix.length() + 1, prefix.length() + 18)); d = DateFormatter.parseShortMilliSecond(files[i].substring(prefix.length() + 1, prefix.length() + 18));
f = new File(heapLocation, files[i]); f = new File(heapLocation, files[i]);
time = d.getTime(); time = d.getTime();
oneBlob = (time == maxtime && buffersize > 0) ? new BLOBHeap(f, keylength, ordering, buffersize) : new BLOBHeapModifier(f, keylength, ordering); oneBlob = (time == maxtime) ? new BLOBHeap(f, keylength, ordering, buffersize) : new BLOBHeapModifier(f, keylength, ordering);
sortedItems.put(Long.valueOf(time), new blobItem(d, f, oneBlob)); sortedItems.put(Long.valueOf(time), new blobItem(d, f, oneBlob));
} catch (ParseException e) {continue;} } catch (ParseException e) {continue;}
} }
@ -174,14 +174,14 @@ public class BLOBArray implements BLOB {
* @param location * @param location
* @throws IOException * @throws IOException
*/ */
public synchronized void mountBLOB(File location) throws IOException { public synchronized void mountBLOB(File location, boolean full) throws IOException {
Date d; Date d;
try { try {
d = DateFormatter.parseShortMilliSecond(location.getName().substring(prefix.length() + 1, prefix.length() + 18)); d = DateFormatter.parseShortMilliSecond(location.getName().substring(prefix.length() + 1, prefix.length() + 18));
} catch (ParseException e) { } catch (ParseException e) {
throw new IOException("date parse problem with file " + location.toString() + ": " + e.getMessage()); throw new IOException("date parse problem with file " + location.toString() + ": " + e.getMessage());
} }
BLOB oneBlob = (buffersize > 0) ? new BLOBHeap(location, keylength, ordering, buffersize) : new BLOBHeapModifier(location, keylength, ordering); BLOB oneBlob = (full && buffersize > 0) ? new BLOBHeap(location, keylength, ordering, buffersize) : new BLOBHeapModifier(location, keylength, ordering);
blobs.add(new blobItem(d, location, oneBlob)); blobs.add(new blobItem(d, location, oneBlob));
} }
@ -555,7 +555,7 @@ public class BLOBArray implements BLOB {
Log.logInfo("BLOBArray", "merging " + f1.getName() + " with " + f2.getName()); Log.logInfo("BLOBArray", "merging " + f1.getName() + " with " + f2.getName());
File resultFile = mergeWorker(f1, f2, payloadrow, newFile); File resultFile = mergeWorker(f1, f2, payloadrow, newFile);
if (resultFile == null) return null; if (resultFile == null) return null;
mountBLOB(resultFile); mountBLOB(resultFile, false);
Log.logInfo("BLOBArray", "merged " + f1.getName() + " with " + f2.getName() + " into " + resultFile); Log.logInfo("BLOBArray", "merged " + f1.getName() + " with " + f2.getName() + " into " + resultFile);
return resultFile; return resultFile;
} }

@ -91,7 +91,7 @@ public final class ReferenceContainerArray {
} }
public void mountBLOBFile(File location) throws IOException { public void mountBLOBFile(File location) throws IOException {
this.array.mountBLOB(location); this.array.mountBLOB(location, false);
} }
public Row rowdef() { public Row rowdef() {

Loading…
Cancel
Save