Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

doubt in Sessin Migration

 
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello ranchers,

I have doubts in session managements. In the distributed web apps, container might do the load-balancing by taking client request and sending them out to JVM's. In these kind of web apps
1. There is one ServletContext per VM.
2.There is one ServletConfig per servlet, per VM.
3. BUT there is only one HttpSession object for given session ID per web apps, regardless the no of VM's. that means only HttpSession objects and their attributes can migrates from one VM to another.

So my question is:-- If there is only one session id given to the session object at a time then how can container recognize a particular clients based on the session ID. becouse till a particular seesion objects invalidates, all the requests are associated with the same session id.
please help me out to understand this as i got stuck in this.

Thanks in advance
 
Bartender
Posts: 4107
72
Hibernate Fedora Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

how can container recognize a particular clients based on the session ID



For the container it's all about requests. Either by cookie information or jsessionid request header of the request, container identify the correct session object which should associate with that request.
 
Poonam Agarwal
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Vijitha for your reply, But my question is how all the request are handled by the conatiner when there is only one Httpsession object with a unique session ID per web apps. when client A sends the request its sends with the particular session ID and when client B sends the request is it also sends with the same session ID??? if this so, then how container differentiate between client A and B?

please reply
Thanks
 
Vijitha Kumara
Bartender
Posts: 4107
72
Hibernate Fedora Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

But my question is how all the request are handled by the conatiner when there is only one Httpsession object with a unique session ID per web apps



No. Each different client has different HttpSession object associated in the server with unique session ID. I think you have misunderstood the statement. When a another client accesses the web app from somewhere else he gets a different HttpSession object created for him with a unique session ID.

In your 3rd statement

BUT there is only one HttpSession object for given session ID per web apps



I think they mean, only one HttpSession object for each different client per web app regardless the app is distributed among more than one JVM.
 
Poonam Agarwal
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Vijitha to make me understand this.. i really appreciate your effort to clear my doubts.

Thanks again
 
Let's go to the waterfront with this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic