fixed problem with cache write

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@394 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 20 years ago
parent 455ae9f55f
commit 8b89c46afe

@ -335,7 +335,9 @@ public final class plasmaCrawlWorker extends Thread {
FileOutputStream fos = null;
try {
fos = new FileOutputStream(cacheFile);
htCache.cacheArray = res.writeContent(fos); // writes in cacheArray and cache file
res.writeContent(fos); // superfluous write to array
htCache.cacheArray = null;
//htCache.cacheArray = res.writeContent(fos); // writes in cacheArray and cache file
} finally {
if (fos!=null)try{fos.close();}catch(Exception e){}
}

@ -458,31 +458,16 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
if (entry == null) return false;
// store response header
if ((entry.status == plasmaHTCache.CACHE_FILL) ||
(entry.status == plasmaHTCache.CACHE_STALE_RELOAD_GOOD) ||
(entry.status == plasmaHTCache.CACHE_STALE_RELOAD_BAD)) {
if (entry.responseHeader != null) {
cacheManager.storeHeader(entry.nomalizedURLHash, entry.responseHeader);
log.logInfo("WROTE HEADER for " + entry.cacheFile);
}
// work off unwritten files and undone parsing
String storeError = null;
if (((entry.status == plasmaHTCache.CACHE_FILL) || (entry.status == plasmaHTCache.CACHE_STALE_RELOAD_GOOD)) &&
((storeError = entry.shallStoreCache()) == null)) {
// write file if not written yet
// work off unwritten files
if (entry.cacheArray != null) {
cacheManager.writeFile(entry.url, entry.cacheArray);
log.logInfo("WRITE FILE (" + entry.cacheArray.length + " bytes) " + entry.cacheFile);
log.logInfo("WROTE FILE (" + entry.cacheArray.length + " bytes) for " + entry.cacheFile);
}
// enqueue for further crawling
enQueue(sbQueue.newEntry(entry.url, plasmaURL.urlHash(entry.referrerURL()),
entry.requestHeader.ifModifiedSince(), entry.requestHeader.containsKey(httpHeader.COOKIE),
entry.initiator(), entry.depth, entry.profile.handle(),
entry.name()
));
} else if (entry.status == plasmaHTCache.CACHE_PASSING) {
// even if the file should not be stored in the cache, it can be used to be indexed
if (storeError != null) log.logDebug("NOT STORED " + entry.cacheFile + ":" + storeError);
// enqueue for further crawling
enQueue(sbQueue.newEntry(entry.url, plasmaURL.urlHash(entry.referrerURL()),
@ -490,10 +475,10 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
entry.initiator(), entry.depth, entry.profile.handle(),
entry.name()
));
}
// write log
/*
switch (entry.status) {
case plasmaHTCache.CACHE_UNFILLED:
log.logInfo("CACHE UNFILLED: " + entry.cacheFile); break;
@ -513,6 +498,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
default:
log.logInfo("CACHE STATE UNKNOWN: " + entry.cacheFile); break;
}
*/
return true;
}

Loading…
Cancel
Save