You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2012/08/19 12:36:47 UTC

svn commit: r1374725 - in /ofbiz/trunk/framework/service: build.xml src/org/ofbiz/service/job/JobPoller.java

Author: adrianc
Date: Sun Aug 19 10:36:46 2012
New Revision: 1374725

URL: http://svn.apache.org/viewvc?rev=1374725&view=rev
Log:
Fixed a bug in JobPoller.java where the poller thread would start before all of the components were loaded - causing exceptions to be thrown and unpredictable behavior.

Modified:
    ofbiz/trunk/framework/service/build.xml
    ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobPoller.java

Modified: ofbiz/trunk/framework/service/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/build.xml?rev=1374725&r1=1374724&r2=1374725&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/build.xml (original)
+++ ofbiz/trunk/framework/service/build.xml Sun Aug 19 10:36:46 2012
@@ -31,6 +31,7 @@ under the License.
 
     <path id="local.class.path">
         <fileset dir="${lib.dir}" includes="*.jar"/>
+        <fileset dir="../.." includes="ofbiz.jar"/>
         <fileset dir="../base/lib" includes="*.jar"/>
         <fileset dir="../base/lib/commons" includes="*.jar"/>
         <fileset dir="../base/lib/j2eespecs" includes="*.jar"/>

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobPoller.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobPoller.java?rev=1374725&r1=1374724&r2=1374725&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobPoller.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobPoller.java Sun Aug 19 10:36:46 2012
@@ -33,6 +33,7 @@ import java.util.concurrent.ThreadPoolEx
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 
+import org.ofbiz.base.start.Start;
 import org.ofbiz.base.util.Assert;
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.service.config.ServiceConfigUtil;
@@ -249,8 +250,9 @@ public final class JobPoller {
         public void run() {
             Debug.logInfo("JobPoller thread started.", module);
             try {
-                // wait 30 seconds before the first poll
-                Thread.sleep(30000);
+                while (Start.getInstance().getCurrentState() != Start.ServerState.RUNNING) {
+                    Thread.sleep(1000);
+                }
                 while (!executor.isShutdown()) {
                     int remainingCapacity = executor.getQueue().remainingCapacity();
                     if (remainingCapacity > 0) {