Author: toad
Date: 2008-07-18 21:22:34 +0000 (Fri, 18 Jul 2008)
New Revision: 21224
Modified:
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerBase.java
Log:
Synchronization, fix race condition
Modified:
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerBase.java
===================================================================
---
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerBase.java
2008-07-18 21:22:12 UTC (rev 21223)
+++
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerBase.java
2008-07-18 21:22:34 UTC (rev 21224)
@@ -85,7 +85,7 @@
if(logMINOR) Logger.minor(this, "Registered "+req+" on
prioclass="+prio+", retrycount="+retryCount+" v.size()="+v.size());
}
- void addToGrabArray(short priorityClass, int retryCount, int rc, Object
client, ClientRequester cr, SendableRequest req, RandomSource random,
ObjectContainer container) {
+ synchronized void addToGrabArray(short priorityClass, int retryCount,
int rc, Object client, ClientRequester cr, SendableRequest req, RandomSource
random, ObjectContainer container) {
if((priorityClass > RequestStarter.MINIMUM_PRIORITY_CLASS) ||
(priorityClass < RequestStarter.MAXIMUM_PRIORITY_CLASS))
throw new IllegalStateException("Invalid priority:
"+priorityClass+" - range is "+RequestStarter.MAXIMUM_PRIORITY_CLASS+" (most
important) to "+RequestStarter.MINIMUM_PRIORITY_CLASS+" (least important)");
// Priority