List of all sessions

100 views
Skip to first unread message

Ján Raska

unread,
Jan 28, 2011, 4:13:31 AM1/28/11
to lif...@googlegroups.com
Hi all,
is it possible to somehow get a list of all sessions? I'd like to build some tool for the administrator to be able to destroy some particular sessions if necessary. Also I'd like to have save session counts for site monitoring and optimization.

Thanks

Rusho

Timothy Perrett

unread,
Jan 28, 2011, 4:25:26 AM1/28/11
to lif...@googlegroups.com
To get the session numbers:

import net.liftweb.actor.LiftActor
import net.liftweb.http.SessionWatcherInfo

object SessionMonitor extends LiftActor {
  private var sessionSize = 0
  protected def messageHandler = {
    case SessionWatcherInfo(sessions) => sessionSize = sessions.size
  }
}


SessionMaster.sessionWatchers = 
  SessionMonitor :: SessionMaster.sessionWatchers
  

Obviously the sessionSize variable will then be incremented with the number of sessions. In Lift in Action I describe how you can use this sort of technique with Ostrich to take occasionally gauges on session load. 

Cheers, Tim

santhosh kumar

unread,
Jan 28, 2011, 4:22:40 AM1/28/11
to lif...@googlegroups.com
yes id like to know the same thing too. If i can get teh session handlers of all the active sessions it ll be useful. 
--
Regards

Santhosh
9941497246
twitter: twitter.com/santhotech (@santhotech)

santhosh kumar

unread,
Jan 28, 2011, 4:28:37 AM1/28/11
to lif...@googlegroups.com
"Lift in Action" is that a book you wrote. Is it free. Where can i get it.

--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.

Timothy Perrett

unread,
Jan 28, 2011, 10:08:01 AM1/28/11
to lif...@googlegroups.com
Sure, its a book im writing: http://manning.com/perrett/

Most of the chapters are written but the book will be released around June / July time. Feel free to pick up the early access edition right now though. 

Cheers, Tim
Reply all
Reply to author
Forward
0 new messages