details:   https://code.openbravo.com/erp/devel/pi/rev/33576bf5296b
changeset: 30674:33576bf5296b
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Tue Nov 22 13:15:57 2016 +0100
summary:   fixed issue 34596: make configurable ImportEntry wait time

  The time to wait between loops to check if new import entries are present is
  now configurable through import.wait.time property that defines the number
  of seconds to wait.

  Default is kept to 10 minutes as it was before it was configurable.

diffstat:

 src/org/openbravo/service/importprocess/ImportEntryManager.java |  13 ++++++---
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (47 lines):

diff -r 64b44ea14896 -r 33576bf5296b 
src/org/openbravo/service/importprocess/ImportEntryManager.java
--- a/src/org/openbravo/service/importprocess/ImportEntryManager.java   Mon Nov 
21 18:00:55 2016 +0100
+++ b/src/org/openbravo/service/importprocess/ImportEntryManager.java   Tue Nov 
22 13:15:57 2016 +0100
@@ -144,9 +144,8 @@
 
   private boolean threadsStarted = false;
 
-  // TODO: make this a preference
   private long initialWaitTime = 10000;
-  private long managerWaitTime = 60000;
+  private long managerWaitTime = 600_000L;
 
   // default to number of processors plus some additionals for the main threads
   private int numberOfThreads = Runtime.getRuntime().availableProcessors() + 3;
@@ -175,6 +174,10 @@
         numberOfThreads, 4);
     maxTaskQueueSize = ImportProcessUtils.getCheckIntProperty(log, 
"import.max.task.queue.size",
         maxTaskQueueSize, 50);
+    managerWaitTime = ImportProcessUtils.getCheckIntProperty(log, 
"import.wait.time", 600, 1);
+
+    // property defined in secs, convert to ms
+    managerWaitTime = managerWaitTime * 1000;
   }
 
   public synchronized void start() {
@@ -494,7 +497,7 @@
         try {
           if (!wasNotifiedInParallel) {
             log.debug("Waiting for next cycle or new import entries");
-            monitorObject.wait(10 * manager.managerWaitTime);
+            monitorObject.wait(manager.managerWaitTime);
             log.debug("Woken");
           }
           wasNotifiedInParallel = false;
@@ -637,10 +640,10 @@
           } catch (Throwable t) {
             ImportProcessUtils.logError(log, t);
 
-            // wait otherwise the loop goes wild in case of really severe
+            // wait for 5 min otherwise the loop goes wild in case of really 
severe
             // system errors like full disk
             try {
-              Thread.sleep(5 * manager.managerWaitTime);
+              Thread.sleep(300_000L);
             } catch (Exception ignored) {
             }
           }

------------------------------------------------------------------------------
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to