The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Session migration 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 "Session migration" Watch "Session migration" New topic

Session migration

Stanislav Chekalin

Joined: Jun 18, 2009
Posts: 9

I have finished reading HFSJ second time and currently am preparing for the exam with the help of Enthuware JWeb Plus V5.

The question(QID com.enthuware.ets.scwcd.v5.2.328) is "Assuming that a web application is marked as distributed, which of the following statements are correct:" and one of the correct answers was "All request that belong to a session are handled by one JVM at a time."

Could somebody please explain this to me? I thought that session migration happens exactly when different requests come for one session to different JVMs.

How I understand it:
Say a user has made request1, which was sent to JVM1 and which created a session. Then the users make request 2 and it is sent to another JVM, say, JVM2. The container sees that the session associated with this request is on JVM1 and migrates the session object to JVM2. That is when SessionActivationListener gets informed.

Am I wrong?

If "All request that belong to a session are handled by one JVM at a time." then in what case does the migration happen?

SCJP 90%
preparing for SCWCD
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper

Joined: Apr 07, 2010
Posts: 2092

Hi Stanislav,

By reading your story I think that you understood it well.

But what the authors (enthuware) might have wanted to say is that there are not two requests handled by two JVMs at the same time. The Session object is not replicated but migrated. If the Session object was available in both JVMs at the same time it could handle each incoming request without having to migrate.

Hope this makes a bit more sense.

I agree. Here's the link:
subject: Session migration
It's not a secret anymore!