Author: toad
Date: 2009-02-14 01:05:17 +0000 (Sat, 14 Feb 2009)
New Revision: 25634
Modified:
branches/db4o/freenet/src/freenet/support/io/PersistentBlobTempBucketFactory.java
Log:
Locking
Modified:
branches/db4o/freenet/src/freenet/support/io/PersistentBlobTempBucketFactory.java
===================================================================
---
branches/db4o/freenet/src/freenet/support/io/PersistentBlobTempBucketFactory.java
2009-02-14 00:50:45 UTC (rev 25633)
+++
branches/db4o/freenet/src/freenet/support/io/PersistentBlobTempBucketFactory.java
2009-02-14 01:05:17 UTC (rev 25634)
@@ -176,9 +176,11 @@
Logger.error(this, "Tags in database: "+inDB+"
but size of file allows: "+ptr);
// Recover: exhaustive index search. This can
cause very long pauses, but should only happen if there is a bug.
for(long l = 0; l < ptr; l++) {
- if(freeSlots.containsKey(l)) continue;
- if(notCommittedBlobs.containsKey(l))
continue;
- if(almostFreeSlots.containsKey(l))
continue;
+ synchronized(this) {
+ if(freeSlots.containsKey(l))
continue;
+
if(notCommittedBlobs.containsKey(l)) continue;
+
if(almostFreeSlots.containsKey(l)) continue;
+ }
query = container.query();
query.constrain(PersistentBlobTempBucketTag.class);
query.descend("index").constrain(l);
@@ -187,7 +189,9 @@
Logger.error(this, "FOUND EMPTY SLOT:
"+l+" when scanning the blob file because tags in database < length of file");
PersistentBlobTempBucketTag tag = new
PersistentBlobTempBucketTag(PersistentBlobTempBucketFactory.this, l);
container.store(tag);
- freeSlots.put(ptr, tag);
+ synchronized(this) {
+ freeSlots.put(ptr, tag);
+ }
added++;
if(added > MAX_FREE) return;
}
_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs