Author: toad
Date: 2007-08-11 13:02:45 +0000 (Sat, 11 Aug 2007)
New Revision: 14599
Modified:
trunk/freenet/src/freenet/client/ArchiveManager.java
trunk/freenet/src/freenet/client/ArchiveStoreContext.java
Log:
more comments, sync/space usage consistency fixes
Modified: trunk/freenet/src/freenet/client/ArchiveManager.java
===================================================================
--- trunk/freenet/src/freenet/client/ArchiveManager.java 2007-08-11
12:56:10 UTC (rev 14598)
+++ trunk/freenet/src/freenet/client/ArchiveManager.java 2007-08-11
13:02:45 UTC (rev 14599)
@@ -143,7 +143,8 @@
}
/**
- * Remove a file from the cache.
+ * Remove a file from the cache. Called after it has been removed from
its
+ * ArchiveHandler.
* @param item The ArchiveStoreItem to remove.
*/
synchronized void removeCachedItem(ArchiveStoreItem item) {
@@ -390,9 +391,11 @@
synchronized (this) {
oldItem = (ArchiveStoreItem)
storedData.get(element.key);
storedData.push(element.key, element);
+ if(oldItem != null) {
+ oldItem.close();
+ cachedData -= oldItem.spaceUsed();
+ }
}
- if(oldItem != null)
- oldItem.close();
}
/**
Modified: trunk/freenet/src/freenet/client/ArchiveStoreContext.java
===================================================================
--- trunk/freenet/src/freenet/client/ArchiveStoreContext.java 2007-08-11
12:56:10 UTC (rev 14598)
+++ trunk/freenet/src/freenet/client/ArchiveStoreContext.java 2007-08-11
13:02:45 UTC (rev 14599)
@@ -110,7 +110,6 @@
}
if(item == null) break;
manager.removeCachedItem(item);
- item.context.removeItem(item);
}
}
@@ -121,7 +120,9 @@
}
}
- /** Notify that an archive store item with this key has been expelled
from the cache. */
+ /** Notify that an archive store item with this key has been expelled
from the
+ * cache. Remove it from our local cache and ask it to free the bucket
if
+ * necessary. */
public void removeItem(ArchiveStoreItem item) {
synchronized(myItems) {
if(myItems.remove(item) == null) return; // only
removed once