From 9705a0a7876ccddbfe8360d0b1ef8b8a167bd407 Mon Sep 17 00:00:00 2001 From: hns Date: Thu, 7 Feb 2008 12:42:13 +0000 Subject: [PATCH] * Explicitely wrap loadSessionData() into a transaction. --- src/helma/framework/core/SessionManager.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/helma/framework/core/SessionManager.java b/src/helma/framework/core/SessionManager.java index 4e66e9c95..f0b281fb8 100644 --- a/src/helma/framework/core/SessionManager.java +++ b/src/helma/framework/core/SessionManager.java @@ -16,8 +16,8 @@ package helma.framework.core; import helma.objectmodel.INode; -import helma.objectmodel.db.Node; import helma.objectmodel.db.NodeHandle; +import helma.objectmodel.db.Transactor; import helma.scripting.ScriptingEngine; import java.util.*; @@ -206,8 +206,10 @@ public void loadSessionData(File f, ScriptingEngine engine) { } long now = System.currentTimeMillis(); + Transactor tx = Transactor.getInstance(app.getNodeManager()); try { + tx.begin("sessionloader"); // load the stored data: InputStream istream = new BufferedInputStream(new FileInputStream(f)); ObjectInputStream p = new ObjectInputStream(istream); @@ -230,11 +232,17 @@ public void loadSessionData(File f, ScriptingEngine engine) { istream.close(); sessions = newSessions; app.logEvent("loaded " + newSessions.size() + " sessions from file"); + tx.commit(); } catch (FileNotFoundException fnf) { // suppress error message if session file doesn't exist + tx.abort(); } catch (Exception e) { app.logError("error loading session data.", e); + tx.abort(); + } finally { + tx.closeConnections(); } + } /**