[freenet-cvs] r14592 - trunk/freenet/src/freenet/client

toad at freenetproject.org toad at freenetproject.org
Sat Aug 11 12:31:31 UTC 2007


Author: toad
Date: 2007-08-11 12:31:31 +0000 (Sat, 11 Aug 2007)
New Revision: 14592

Modified:
   trunk/freenet/src/freenet/client/ArchiveStoreContext.java
Log:
Comments on locking.
Make some fields private.

Modified: trunk/freenet/src/freenet/client/ArchiveStoreContext.java
===================================================================
--- trunk/freenet/src/freenet/client/ArchiveStoreContext.java	2007-08-11 12:27:27 UTC (rev 14591)
+++ trunk/freenet/src/freenet/client/ArchiveStoreContext.java	2007-08-11 12:31:31 UTC (rev 14592)
@@ -70,7 +70,7 @@
 	}
 
 	// Archive size
-	long lastSize = -1;
+	private long lastSize = -1;
 	
 	/** Returns the size of the archive last time we fetched it, or -1 */
 	long getLastSize() {
@@ -84,7 +84,7 @@
 
 	// Archive hash
 	
-	byte[] lastHash;
+	private byte[] lastHash;
 	
 	/** Returns the hash of the archive last time we fetched it, or null */
 	public byte[] getLastHash() {
@@ -96,10 +96,11 @@
 		lastHash = realHash;
 	}
 	
-	// Index of still-cached ArchiveStoreItems with this key
-	
-	/** Index of still-cached ArchiveStoreItems with this key */
-	final DoublyLinkedListImpl myItems;
+	/** Index of still-cached ArchiveStoreItems with this key.
+	 * Note that we never ever hold this and then take another lock! In particular
+	 * we must not take the ArchiveManager lock while holding this lock. It must be
+	 * the inner lock to avoid deadlocks. */
+	private final DoublyLinkedListImpl myItems;
 
 	/**
 	 * Remove all ArchiveStoreItems with this key from the cache.




More information about the cvs mailing list