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?
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.
And tomorrow is the circus! We can go to the circus! I love the circus! We can take this tiny ad: