From 2ec32f146a2281c84d731f8c53769d196c594293 Mon Sep 17 00:00:00 2001 From: hns Date: Fri, 15 Dec 2006 15:10:34 +0000 Subject: [PATCH] * Null out scriptingEngine if initScriptingEngine() fails. * Make sure we cause no uncaught exceptions in request evaluator loop, will cause helma to hang. * Make initScriptingEngine() synchronized. --- src/helma/framework/core/RequestEvaluator.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/helma/framework/core/RequestEvaluator.java b/src/helma/framework/core/RequestEvaluator.java index 3a4f02f4..d9c2c44b 100644 --- a/src/helma/framework/core/RequestEvaluator.java +++ b/src/helma/framework/core/RequestEvaluator.java @@ -85,7 +85,7 @@ public final class RequestEvaluator implements Runnable { this.app = app; } - protected void initScriptingEngine() { + protected synchronized void initScriptingEngine() { if (scriptingEngine == null) { String engineClassName = app.getProperty("scriptingEngine", "helma.scripting.rhino.RhinoEngine"); @@ -108,6 +108,8 @@ public final class RequestEvaluator implements Runnable { app.logEvent("******************************************"); app.logError("Error creating scripting engine", t); + // null out invalid scriptingEngine + scriptingEngine = null; // rethrow exception if (t instanceof RuntimeException) { throw((RuntimeException) t); @@ -566,12 +568,12 @@ public final class RequestEvaluator implements Runnable { } // exit execution context - scriptingEngine.exitContext(); + if (scriptingEngine != null) + scriptingEngine.exitContext(); notifyAndWait(); } - } finally { localrtx.closeConnections(); }