Hi
What is Session Migration in Java?
Session Migration in Servlet
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Prabhu RajaRank #861 · 2.6K reputationPosted Nov 9, 2011, 8:44 PM EST
Check out Here : http://www.interviewcorner.com/Answer/3944/session-migration-in-java
AartiRank #2,383 · 594 reputationPosted Dec 25, 2011, 9:52 PM EST
For a session migration listener, implement the HttpSessionActivationListener interface and write code for the methods sessionDidActivate() (for actions at session activation) and sessionWillPassivate() (for actions at session passivation), as appropriate.
Listner :HttpSessionActivationListener Methods
The HttpSessionActivationListener interface specifies the following methods. Implement this interface in a listener class you will use to track session migration (activation or passivation) events.
•void sessionDidActivate(HttpSessionEvent hse)
The servlet container calls this method when the session is activated.
•void sessionWillPassivate(HttpSessionEvent hse)
The servlet container calls this method when the session is about to be passivated.
The servlet container creates an instance of the HttpSessionEvent class to use as input for HttpSessionActivationListener method calls. See "HttpSessionListener Methods, HttpSessionEvent Class" for information about this class.
Satyapriya NayakRank #47 · 31.5K reputationPosted Dec 25, 2011, 11:11 PM EST
Session Migration is a mechanism of moving the session from one server to another in case of server failure. Session Migration can be implemented by:
a) Persisting the session into database
b) Storing the session in-memory on multiple servers.
Thanks