[freenet-cvs] r18931 - trunk/freenet/src/freenet/client/async

nextgens at freenetproject.org nextgens at freenetproject.org
Thu Apr 3 06:39:59 UTC 2008


Author: nextgens
Date: 2008-04-03 06:39:58 +0000 (Thu, 03 Apr 2008)
New Revision: 18931

Modified:
   trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java
Log:
more sync fixes

Modified: trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java
===================================================================
--- trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java	2008-04-03 06:00:55 UTC (rev 18930)
+++ trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java	2008-04-03 06:39:58 UTC (rev 18931)
@@ -483,14 +483,16 @@
 							req.getPriorityClass()+", retries "+req.getRetryCount()+", client "+req.getClient()+", client-req "+req.getClientRequest()+ ')');
 					ClientRequester cr = req.getClientRequest();
 					if(req.canRemove()) {
-						HashSet v = (HashSet) allRequestsByClientRequest.get(cr);
-						if(v == null) {
-							Logger.error(this, "No HashSet registered for "+cr);
-						} else {
-							boolean removed = v.remove(req);
-							if(v.isEmpty())
-								allRequestsByClientRequest.remove(cr);
-							if(logMINOR) Logger.minor(this, (removed ? "" : "Not ") + "Removed from HashSet for "+cr+" which now has "+v.size()+" elements");
+						synchronized(this) {
+							HashSet v = (HashSet) allRequestsByClientRequest.get(cr);
+							if(v == null) {
+								Logger.error(this, "No HashSet registered for "+cr);
+							} else {
+								boolean removed = v.remove(req);
+								if(v.isEmpty())
+									allRequestsByClientRequest.remove(cr);
+								if(logMINOR) Logger.minor(this, (removed ? "" : "Not ") + "Removed from HashSet for "+cr+" which now has "+v.size()+" elements");
+							}
 						}
 						// Do not remove from the pendingKeys list.
 						// Whether it is running a request, waiting to execute, or waiting on the




More information about the cvs mailing list