Author: toad
Date: 2009-04-02 16:46:01 +0000 (Thu, 02 Apr 2009)
New Revision: 26363
Modified:
trunk/freenet/src/freenet/support/SectoredRandomGrabArray.java
Log:
More synchronization
Modified: trunk/freenet/src/freenet/support/SectoredRandomGrabArray.java
===================================================================
--- trunk/freenet/src/freenet/support/SectoredRandomGrabArray.java
2009-04-02 16:45:22 UTC (rev 26362)
+++ trunk/freenet/src/freenet/support/SectoredRandomGrabArray.java
2009-04-02 16:46:01 UTC (rev 26363)
@@ -297,29 +297,29 @@
public void maybeRemove(RemoveRandom r, ObjectContainer container) {
int count = 0;
+ synchronized(this) {
while(true) {
int found = -1;
- synchronized(this) {
for(int i=0;i<grabArrays.length;i++) {
if(grabArrays[i] == r) {
found = i;
break;
}
}
- }
if(found != -1) {
count++;
if(count > 1) Logger.error(this, "Found "+r+" many
times in "+this, new Exception("error"));
removeElement(found);
} else {
- if(count == 0) Logger.error(this, "Not in parent: "+r+"
for "+this, new Exception("error"));
- else if(persistent) {
- container.store(this);
- r.removeFrom(container);
- }
- return;
+ break;
}
}
+ }
+ if(count == 0) Logger.error(this, "Not in parent: "+r+" for
"+this, new Exception("error"));
+ else if(persistent) {
+ container.store(this);
+ r.removeFrom(container);
+ }
}
}
_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs