Author: robert
Date: 2008-03-14 23:32:11 +0000 (Fri, 14 Mar 2008)
New Revision: 18537
Modified:
trunk/freenet/src/freenet/support/SerialExecutor.java
Log:
allow queued jobs before start (fixes global queue)
Modified: trunk/freenet/src/freenet/support/SerialExecutor.java
===================================================================
--- trunk/freenet/src/freenet/support/SerialExecutor.java 2008-03-14
19:41:34 UTC (rev 18536)
+++ trunk/freenet/src/freenet/support/SerialExecutor.java 2008-03-14
23:32:11 UTC (rev 18537)
@@ -62,6 +62,10 @@
public void start(Executor realExecutor, String name) {
this.realExecutor=realExecutor;
this.name=name;
+ synchronized (jobs) {
+ if (!jobs.isEmpty())
+ reallyStart();
+ }
}
private void reallyStart() {
@@ -73,7 +77,7 @@
synchronized(jobs) {
jobs.addLast(job);
jobs.notifyAll();
- if (!running)
+ if (!running && realExecutor!=null)
reallyStart();
}
}
@@ -82,7 +86,7 @@
synchronized(jobs) {
jobs.addLast(job);
jobs.notifyAll();
- if (!running)
+ if (!running && realExecutor!=null)
reallyStart();
}
}