r9711 - helma/helma/trunk/src/helma/framework/core

[email protected] Wed, 6 May 2009 14:47:10 +0200 (CEST)
Newsgroups gmane.comp.java.helma.cvs
Message-ID <20090506124710.4EE2F3D0D6@mia>
Author: hannes
Date: 2009-05-06 14:47:10 +0200 (Wed, 06 May 2009)
New Revision: 9711

Modified:
   helma/helma/trunk/src/helma/framework/core/Application.java
Log:
Delay creation of request evaluators until app node has been initialized.

Details at http://dev.helma.org/trac/helma/changeset/9711

Modified: helma/helma/trunk/src/helma/framework/core/Application.java
===================================================================
--- helma/helma/trunk/src/helma/framework/core/Application.java	2009-05-05 19:46:11 UTC (rev 9710)
+++ helma/helma/trunk/src/helma/framework/core/Application.java	2009-05-06 12:47:10 UTC (rev 9711)
@@ -393,29 +393,6 @@
             freeThreads = new Stack();
             allThreads = new Vector();
 
-            // preallocate minThreads request evaluators
-            int minThreads = 0;
-
-            try {
-                minThreads = Integer.parseInt(props.getProperty("minThreads"));
-            } catch (Exception ignore) {
-                // not parsable as number, keep 0
-            }
-
-            if (minThreads > 0) {
-                logEvent("Starting "+minThreads+" evaluator(s) for " + name);
-            }
-
-            for (int i = 0; i < minThreads; i++) {
-                RequestEvaluator ev = new RequestEvaluator(Application.this);
-
-                if (i == 0) {
-                    ev.initScriptingEngine();
-                }
-                freeThreads.push(ev);
-                allThreads.addElement(ev);
-            }
-
             activeRequests = new Hashtable();
             activeCronJobs = new Hashtable();
             customCronJobs = new Hashtable();
@@ -473,6 +450,29 @@
                     releaseEvaluator(ev);
                 }
             }
+            
+            // preallocate minThreads request evaluators
+            int minThreads = 0;
+
+            try {
+                minThreads = Integer.parseInt(props.getProperty("minThreads"));
+            } catch (Exception ignore) {
+                // not parsable as number, keep 0
+            }
+
+            if (minThreads > 0) {
+                logEvent("Starting "+minThreads+" evaluator(s) for " + name);
+            }
+
+            for (int i = 0; i < minThreads; i++) {
+                RequestEvaluator ev = new RequestEvaluator(Application.this);
+
+                if (i == 0) {
+                    ev.initScriptingEngine();
+                }
+                freeThreads.push(ev);
+                allThreads.addElement(ev);
+            }
         }
     }