Recognize Timeouts without explicit timeout flag, just comparing

if we still "own" the evaluator thread.
This commit is contained in:
hns 2002-09-04 16:32:26 +00:00
parent 3713d73580
commit 9c8c460355

View file

@ -62,9 +62,6 @@ public final class FesiEvaluator implements ScriptingEngine {
// the global vars set by extensions // the global vars set by extensions
HashMap extensionGlobals; 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. * 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 { public void enterContext (HashMap globals) throws ScriptingException {
// set the thread filed in the FESI evaluator // set the thread filed in the FESI evaluator
evaluator.thread = Thread.currentThread (); evaluator.thread = Thread.currentThread ();
// unset timeot flag
timeout = false;
// set globals on the global object // set globals on the global object
globals.putAll(extensionGlobals); globals.putAll(extensionGlobals);
if (globals != null && globals != lastGlobals) { if (globals != null && globals != lastGlobals) {
@ -405,7 +400,7 @@ public final class FesiEvaluator implements ScriptingEngine {
if (reval.res.getNotModified()) if (reval.res.getNotModified())
throw new RedirectException (null); throw new RedirectException (null);
// has the request timed out? If so, throw TimeoutException // has the request timed out? If so, throw TimeoutException
if (timeout) if (evaluator.thread != Thread.currentThread())
throw new TimeoutException (); throw new TimeoutException ();
// create and throw a ScriptingException with the right message // create and throw a ScriptingException with the right message
String msg = x.getMessage (); String msg = x.getMessage ();
@ -425,9 +420,6 @@ public final class FesiEvaluator implements ScriptingEngine {
* object to null. * object to null.
*/ */
public void abort () { 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 // unset the thread filed in the FESI evaluator
evaluator.thread = null; evaluator.thread = null;
} }