From 9c8c460355dfe632205b097e657a4b0114812ced Mon Sep 17 00:00:00 2001 From: hns Date: Wed, 4 Sep 2002 16:32:26 +0000 Subject: [PATCH] Recognize Timeouts without explicit timeout flag, just comparing if we still "own" the evaluator thread. --- src/helma/scripting/fesi/FesiEvaluator.java | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/helma/scripting/fesi/FesiEvaluator.java b/src/helma/scripting/fesi/FesiEvaluator.java index 2ccc4e15..93dc1555 100644 --- a/src/helma/scripting/fesi/FesiEvaluator.java +++ b/src/helma/scripting/fesi/FesiEvaluator.java @@ -62,9 +62,6 @@ public final class FesiEvaluator implements ScriptingEngine { // the global vars set by extensions HashMap extensionGlobals; - // flag tells us if the current request has timed out - // and exceptions should thus be rethrown as TimeoutExceptions. - private volatile boolean timeout; /** * Create a FESI evaluator for the given application and request evaluator. @@ -300,8 +297,6 @@ public final class FesiEvaluator implements ScriptingEngine { public void enterContext (HashMap globals) throws ScriptingException { // set the thread filed in the FESI evaluator evaluator.thread = Thread.currentThread (); - // unset timeot flag - timeout = false; // set globals on the global object globals.putAll(extensionGlobals); if (globals != null && globals != lastGlobals) { @@ -405,7 +400,7 @@ public final class FesiEvaluator implements ScriptingEngine { if (reval.res.getNotModified()) throw new RedirectException (null); // has the request timed out? If so, throw TimeoutException - if (timeout) + if (evaluator.thread != Thread.currentThread()) throw new TimeoutException (); // create and throw a ScriptingException with the right message String msg = x.getMessage (); @@ -425,9 +420,6 @@ public final class FesiEvaluator implements ScriptingEngine { * object to null. */ public void abort () { - // set the timeout flag so we exceptions are - // rethrown as timeout exceptions - timeout = true; // unset the thread filed in the FESI evaluator evaluator.thread = null; }