aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes how does the HttpSession move from one JVM to another? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "how does the HttpSession move from one JVM to another? " Watch "how does the HttpSession move from one JVM to another? " New topic
Author

how does the HttpSession move from one JVM to another?

Timber Lee
Ranch Hand

Joined: Oct 14, 2002
Posts: 157
how does the HttpSession move from one JVM to another?
thanks for help!


SCJP<br />SCWCD<br />SCEA
g madhava
Ranch Hand

Joined: Sep 14, 2001
Posts: 85
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

Joined: Jul 23, 2002
Posts: 113
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

Joined: Aug 22, 2001
Posts: 116
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

Joined: Apr 20, 2000
Posts: 3252
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

Joined: Aug 22, 2001
Posts: 116
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how does the HttpSession move from one JVM to another?
 
Similar Threads
HttpSessionEvent - Propagated across JVM?
session of distributed web application
Why serialization?
HttpSession de-serialization
How to pass Session object between two web apps