Author: toad
Date: 2009-03-05 19:42:23 +0000 (Thu, 05 Mar 2009)
New Revision: 25895

Modified:
   branches/db4o/freenet/src/freenet/client/FECQueue.java
Log:
Fix failing to notify resulting in FEC threads blocking forever in 
getFECJobBlockingNoDBAccess.


Modified: branches/db4o/freenet/src/freenet/client/FECQueue.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/FECQueue.java      2009-03-05 
19:41:02 UTC (rev 25894)
+++ branches/db4o/freenet/src/freenet/client/FECQueue.java      2009-03-05 
19:42:23 UTC (rev 25895)
@@ -294,11 +294,13 @@
                                                        if(logMINOR) 
Logger.minor(this, "Maybe adding "+job);
                                                        
synchronized(FECQueue.this) {
                                                                if(job.running) 
{
+                                                                       j--;
                                                                        
if(logMINOR) Logger.minor(this, "Not adding, already running: "+job);
                                                                        
continue;
                                                                }
                                                                
if(persistentQueueCache[prio].contains(job)) {
                                                                        j--;
+                                                                       
if(logMINOR) Logger.minor(this, "Not adding as on persistent queue cache for 
"+prio+" : "+job);
                                                                        
continue;
                                                                }
                                                                boolean added = 
false;
@@ -308,11 +310,13 @@
                                                                                
it.previous();
                                                                                
it.add(job);
                                                                                
added = true;
-                                                                               
addedAny = true;
+                                                                               
if(logMINOR) Logger.minor(this, "Adding "+job+" before "+it);
                                                                                
break;
                                                                        }
                                                                }
                                                                if(!added) 
persistentQueueCache[prio].addLast(job);
+                                                               if(logMINOR) 
Logger.minor(this, "Added "+job);
+                                                               addedAny = true;
                                                        }
                                                }
                                        }
@@ -320,6 +324,9 @@
                                if(!addedAny) {
                                        if(logMINOR)
                                                Logger.minor(this, "No more 
jobs to add");
+                                       synchronized(FECQueue.this) {
+                                               FECQueue.this.notifyAll();
+                                       }
                                        return;
                                } else {
                                        int maxRunningThreads = 
getMaxRunningFECThreads();
@@ -337,6 +344,7 @@
                                                                
runningFECThreads++;
                                                        }
                                                }
+                                               FECQueue.this.notifyAll();
                                        }
                                }
                        }

_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to