[Logo] Terracotta Discussion Forums (LEGACY READ-ONLY ARCHIVE)
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
accessing sessions list  XML
Forum Index -> Terracotta for Web Sessions
Author Message
bruyeron

neo

Joined: 07/03/2007 02:19:17
Messages: 2
Offline


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)
teck

seraphim
[Avatar]
Joined: 05/24/2006 15:03:25
Messages: 1128
Offline

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)

I'm a little wary of providing direct access to the session root. There used to be something like that in servlet spec (but has been long since removed for security reasons): http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/http/HttpSessionContext.html

Enabling the session listeners events cluster wide is neat idea, and would be a new feature -- nothing like that exists yet

Tim Eck (terracotta engineer)
bruyeron

neo

Joined: 07/03/2007 02:19:17
Messages: 2
Offline


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 :-)
 
Forum Index -> Terracotta for Web Sessions
Go to:   
Powered by JForum 2.1.7 © JForum Team