how to kill sessions via webapp when using mod_jk cluster
Posted on 2009-07-10
Our webapp currently runs on Tomcat 5.5 w/ Apache webserver. Our sysadmin has setup two tomcat instances (A & B) to enable us to do updates to one instance while the other takes over all the traffic.
We have a custom developed sessions admin screen which allows us to view current sessions, the accounts linked to those sessions and do actions such as kill the session if needed. This works simply enough when there is only one instance of Tomcat, hence only one application-level hash of sessions.
We want to write a new version of the admin screen which will show all sessions from both instances of Tomcat and also allow us to kill a particular session, regardless of which Tomcat instance it is running. How does one do this?
Note: While references to sessions are currently stored within a app-scoped variable we will be storing the session ID's in a database. So we will have a single place to enumerate all existing sessions regardless of Tomcat instance. The problem is how to know which Tomcat instance a particular session is running upon and how to make the call to kill the session on that instance.