From 70c50c5625fd9bd25b730e27aeb4ad19b4b37252 Mon Sep 17 00:00:00 2001 From: hns Date: Fri, 30 Nov 2007 12:32:42 +0000 Subject: [PATCH] * Implement calling of User.onLogout in Session.logout(). Fixes bug 579 --- src/helma/framework/core/Session.java | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/helma/framework/core/Session.java b/src/helma/framework/core/Session.java index 2d8bf3e8..162bb4dc 100644 --- a/src/helma/framework/core/Session.java +++ b/src/helma/framework/core/Session.java @@ -100,9 +100,26 @@ public class Session implements Serializable { * Remove this sessions's user node. */ public void logout() { - userHandle = null; - uid = null; - lastModified = System.currentTimeMillis(); + if (userHandle != null) { + // invoke User.onLogout + RequestEvaluator reval = null; + try { + reval = app.getEvaluator(); + reval.invokeInternal(userHandle, "onLogout", new Object[] {sessionId}); + } catch (Exception x) { + // errors should already be logged by requestevaluator, but you never know + app.logError("Error in onLogout", x); + } finally { + // do the actual work + userHandle = null; + uid = null; + lastModified = System.currentTimeMillis(); + // release the evaluator + if (reval != null) { + app.releaseEvaluator(reval); + } + } + } } /**