} catch (Exception ignore) {
System.out.println(ignore.toString());
}
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);
int size = p.readInt();
int ct = 0;
Hashtable newSessions = new Hashtable();
while (ct < size) {
Session session = (Session) engine.deserialize(p);
if ((now - session.lastTouched()) < (sessionTimeout * 60000)) {
session.setApp(app);
newSessions.put(session.getSessionId(), session);
}
ct++;
}
p.close();
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();
}
}