[jbpm-commits] JBoss JBPM SVN: r6756 - jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor.

do-not-reply at jboss.org do-not-reply at jboss.org
Sat Oct 9 13:55:09 EDT 2010


Author: rebody
Date: 2010-10-09 13:55:08 -0400 (Sat, 09 Oct 2010)
New Revision: 6756

Modified:
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/DispatcherThread.java
Log:
JBPM-2930 don't let idle interval grow too large

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/DispatcherThread.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/DispatcherThread.java	2010-10-09 17:42:11 UTC (rev 6755)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/DispatcherThread.java	2010-10-09 17:55:08 UTC (rev 6756)
@@ -28,17 +28,17 @@
 import org.jbpm.internal.log.Log;
 import org.jbpm.pvm.internal.cmd.CommandService;
 
-/** this thread is responsible for acquiring jobs in the job that need to be 
+/** this thread is responsible for acquiring jobs in the job that need to be
  * executed and then let the JobExecutor dispatch the acquired ids to one of the
- * JobExecutorThreads in the pool.  There is only one dispatcher thread per 
- * JobExecutor.  
- * 
+ * JobExecutorThreads in the pool.  There is only one dispatcher thread per
+ * JobExecutor.
+ *
  * @author Tom Baeyens, Guillaume Porcher
  */
 public class DispatcherThread extends Thread {
 
   private static final Log log = Log.getLog(DispatcherThread.class.getName());
-  
+
   protected JobExecutor jobExecutor;
   protected volatile boolean isActive = true;
   protected boolean checkForNewJobs;
@@ -57,6 +57,7 @@
   public void run() {
     log.info("starting " + getName());
     currentIdleInterval = jobExecutor.getIdleMillis();
+
     try {
       while (isActive) {
         try {
@@ -105,7 +106,9 @@
           }
           // after an exception, the current idle interval is doubled to prevent
           // continuous exception generation when e.g. the db is unreachable
-          currentIdleInterval = currentIdleInterval * 2;
+            if (currentIdleInterval < jobExecutor.getIdleMillisMax()){
+              currentIdleInterval = currentIdleInterval * 2;
+            }
         }
       }
     } finally {
@@ -151,7 +154,7 @@
   public void deactivate() {
     deactivate(false);
   }
-  
+
   public void deactivate(boolean join) {
     if (isActive) {
       log.debug("deactivating "+getName());



More information about the jbpm-commits mailing list