Skip to content
This repository has been archived by the owner on May 9, 2020. It is now read-only.

Commit

Permalink
Fixed: JobPoller does not run and hence scheduled/async jobs are neve…
Browse files Browse the repository at this point in the history
…r 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

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1779596 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
JacquesLeRoux committed Jan 20, 2017
1 parent 19897e7 commit 69db0a0
Showing 1 changed file with 1 addition and 0 deletions.
Expand Up @@ -204,6 +204,7 @@ private static void loadStartupLoaders(Config config,
throw new StartupException(e);
}
}
serverState.compareAndSet(ServerState.STARTING, ServerState.RUNNING);
}

private static void executeShutdownAfterLoadIfConfigured(
Expand Down

0 comments on commit 69db0a0

Please sign in to comment.