/** * Called after a request has been handled. * * @param reval the request evaluator that handled the request */ public void commit(RequestEvaluator reval, SessionManager smgr) { if (modifiedInRequest || cacheLastModified != cacheNode.lastModified()) { if (!registered) { smgr.registerSession(this); registered = true; } modifiedInRequest = false; cacheLastModified = cacheNode.lastModified(); } }
/** Set the cache node for this session. */ public void setCacheNode(INode node) { if (node == null) { throw new NullPointerException("cache node is null"); } this.cacheNode = node; this.cacheLastModified = cacheNode.lastModified(); }
/** Attach the given user node to this session. */ public void login(INode usernode) { if (usernode == null) { userHandle = null; uid = null; } else { userHandle = ((Node) usernode).getHandle(); uid = usernode.getElementName(); } lastModified = System.currentTimeMillis(); modifiedInRequest = true; }
/** * Creates a new Session object. * * @param sessionId ... * @param app ... */ public Session(String sessionId, Application app) { this.sessionId = sessionId; this.app = app; this.uid = null; this.userHandle = null; cacheNode = new TransientNode(app, "session"); cacheLastModified = cacheNode.lastModified(); // HACK - decrease timestamp by 1 to notice modifications // taking place immediately after object creation onSince = System.currentTimeMillis() - 1; lastTouched = lastModified = onSince; }