Type SessionManager not defined in built-in
The WebDSL built-in module defines the following code using a type SessionManager, without declaring that type either as a native class or as a type. Further, it seems that in order to use a type in a HQL query it needs to be declared as an entity. Apparently we need an ‘external entity’?
// section session managementinvoke internalCleanupSessionManagerEntities() every 10 minutes
function internalUpdateSessionManagerTimeout(){
var n : DateTime := now().addMinutes(-30); // update lastUse after 30 minutes to avoid unnecessary db writes, also sets minimum timeout to 30 minutes
var man := getSessionManager();
if(man.lastUse == null || man.lastUse.before(n)){
man.lastUse := now();
}
}function internalCleanupSessionManagerEntities(){
Submitted by Eelco Visser on 5 May 2013 at 15:47
var sessiontimeout := 10000; //minutes
var n : DateTime := now().addMinutes(-1*(sessiontimeout));
var ses := from SessionManager as sc where sc.lastUse is null or sc.lastUse < ~n limit 25; //use limit to avoid loading all obsolete entities in one transaction
for(s : SessionManager in ses){
s.delete();
}
}
Issue Log
SessionManager is a built-in in the compiler https://svn.strategoxt.org/repos/WebDSL/webdsls/trunk/src/org/webdsl/dsl/languages/data-model/session-entity-extra.str. The reason it’s a compiler built-in is because it gets a reference to the securitycontext (principal) and other session entities, which are not known in advance. We can include it in the extra built-ins file with just the static properties for now.
added to extra-built-in.app
Log in to post comments