Author: jleroux
Date: Fri Jan 20 09:56:56 2017
New Revision: 1779596
URL:
http://svn.apache.org/viewvc?rev=1779596&view=revLog:
Fixed: JobPoller does not run and hence scheduled/async jobs are never run
(OFBIZ-9155)
Symptom:
* services that are invoked with "dispatcher.runAsync" stay "pending" in the
job-list and never get executed
* scheduled jobs don't get executed
Steps to Reproduce
* Login to /webtools
* Schedule a Job to run in 5 mins, (for example service "clearAllEntityCaches")
* Wait 7mins
Expected:
* the scheduled service "clearAllEntityCaches" is not "pending" anymore but
should have status "finished"
Actual:
* scheduled service "clearAllEntityCaches" is still "pending"
Analysis:
The problem can be reproduced with the OFBiz 16.11 branxh as well as
with the OFBiz 16.11.01 zip file version and the trunk
JobPoller does get started on OFBiz start but does get stuck on line:
org.apache.ofbiz.service.job.JobPoller.java: 213-215
The reason is that the "Start.ServerState" never reaches "RUNNING"
Doing a full-text scan through the whole source code shows, that there is no
code at all that sets the ServerState to "RUNNING"
Comparing it to the 15.11-branch. There used to be a line:
serverState.compareAndSet(ServerState.STARTING, ServerState.RUNNING)
no such line exists in 16.11 anymore.
jleroux: I confirm the behaviour in R16 branch as well as in trunk.
Leonard's "patch" is a good solution and works for the R16 branch which is less
changed than the trunk when compared to R15.
The same applies to the trunk with the relative block of code which contains
if (serverState.get() == ServerState.STOPPING) {
The line Leonard propose to add was obviously missed during the recent
refactoring.
Thanks: Leonard Lin
Modified:
ofbiz/branches/release16.11/framework/start/src/main/java/org/apache/ofbiz/base/start/StartupControlPanel.java
ofbiz/trunk/framework/start/src/main/java/org/apache/ofbiz/base/start/StartupControlPanel.java
Modified: ofbiz/branches/release16.11/framework/start/src/main/java/org/apache/ofbiz/base/start/StartupControlPanel.java
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release16.11/framework/start/src/main/java/org/apache/ofbiz/base/start/StartupControlPanel.java?rev=1779596&r1=1779595&r2=1779596&view=diff==============================================================================
--- ofbiz/branches/release16.11/framework/start/src/main/java/org/apache/ofbiz/base/start/StartupControlPanel.java (original)
+++ ofbiz/branches/release16.11/framework/start/src/main/java/org/apache/ofbiz/base/start/StartupControlPanel.java Fri Jan 20 09:56:56 2017
@@ -251,6 +251,7 @@ final class StartupControlPanel {
sb.append(path);
}
System.setProperty("java.library.path", sb.toString());
+ serverState.compareAndSet(ServerState.STARTING, ServerState.RUNNING);
}
private static void executeShutdownAfterLoadIfConfigured(
Modified: ofbiz/trunk/framework/start/src/main/java/org/apache/ofbiz/base/start/StartupControlPanel.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/start/src/main/java/org/apache/ofbiz/base/start/StartupControlPanel.java?rev=1779596&r1=1779595&r2=1779596&view=diff==============================================================================
--- ofbiz/trunk/framework/start/src/main/java/org/apache/ofbiz/base/start/StartupControlPanel.java (original)
+++ ofbiz/trunk/framework/start/src/main/java/org/apache/ofbiz/base/start/StartupControlPanel.java Fri Jan 20 09:56:56 2017
@@ -204,6 +204,7 @@ final class StartupControlPanel {
throw new StartupException(e);
}
}
+ serverState.compareAndSet(ServerState.STARTING, ServerState.RUNNING);
}
private static void executeShutdownAfterLoadIfConfigured(