• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how does the HttpSession move from one JVM to another?

 
Timber Lee
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how does the HttpSession move from one JVM to another?
thanks for help!
 
g madhava
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's not that the session is being moved to different JVM's. There would be only one JVM which would be taking care of the sessions.
thanks
 
Tracy Woo
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Timber Lee:
how does the HttpSession move from one JVM to another?
thanks for help!

That is implementation dependent. But the spec mandates that it must be consistent with the Java serialization mechanism. That means, as a developer, you can assume that it will behave as if it were moved using the serialization mechanism.
 
Rama Raghavan
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a distributed application, an application can be deployed onto multiple servers (multiple JVMs on same or different machines).
When a series of client interaction is participating in a session, the container (app server) generally serves all requests for that client from one JVM. But if that server is brought down (for maintenance or crashes), then container serves subsequent requests a second JVM.
In order to preserve the client session, the container must "move" the HttpSession associated with that client. That implementation is container dependent, but the application must be programmed to "distributable" for the container to move and not throw exceptions
Rama
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The container may also move a session for load balancing purposes. But the session may only be processing requests at one single server at any given time.
- Peter
 
Rama Raghavan
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving sessions for load-balancing purposes sounds kinda confusing to me.
Assume several frames send (almost simultaneous) requests to the app server from the same client. If the app server balances these requests by sending to different JVMs (due to load), then do sessions migrate back and forth before these requests are processed?
'cos all these requests should still be are part of the same session, you'd think.
On a side note, weblogic 6.X seems to pin all requests in a session to one JVM, until it has to fail-over.
Rama
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic