I am trying to cluster a tomcat webapp using terracotta, and I like what I am seeing a lot. FYI, I am using tomcat 5.5.23 on JDK6 with TC 2.4-stable1 at the moment.
I do have one problem: if I implement a HttpSessionListener, the listener only gets notified about sessions created on the local JVM. I typically use the listener to keep track of all the sessions - and in one particular case to recover session data when a user comes back without his/her session id.
The issue of course is when I switch to the second tomcat, the session list is not accurate since it only knows about the locally created sessions and not about all the sessions in the cluster.
Is there any way to receive DSO notifications that a session was created from another node in the cluster? Alternatively is there any way to access the DSO root that contains all the session data from the application code (I am guessing I need access to SessionDataStore.store)
It sounds like you already have some code that aggregates session instances based on an HttpSessionListener. I think the easiest approach for doing the aggregation across the cluster would be to use a DSO root in your code.
I'm assuming your listener just has another map in it and sessionCreated() puts entries in there, and sessionDestroyed() removes the map. Turning that map into a DSO root should give you the effect you want (ie. a collection of all sessions in the cluster)
Thanks for your help - that is what I ended up doing indeed, and it seems to work great for what I need.
A cluster wide SessionListener would be great, though :-)