Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Session Migration  RSS feed

 
Sony Agrawal
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IN HFSJ, it is said that if any of the attribute's(object) is not implementing serialization then we should make sure that it implements sessionActivationListener interface . And use those interface method to work around the serialization problem.

So i was thinking what should be written in those method's definition? Then i felt that the method definition would be same as the method definition of serialization class.

What would be the definition of the sessionWillPassivate and sessionDidActivate will be?
 
ramprasad madathil
Ranch Hand
Posts: 489
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the method definition would be same as the method definition of serialization class.


Serialization is not a class. Serializable is a 'tagging' interface. Importantly it does not have methods and is used to flag that instances of a class that implement this interface are 'serializable'. In short there is no extra code that needs to be written to have the jvm serialize your object.

That said, there is another interface called Externalizable which helps the object take full control of the Serialization process and dictate how instances have to be serialized.

What would be the definition of the sessionWillPassivate and sessionDidActivate will be


The same as you would if you were using Externalizable to serialize instances. The methods would roughly correspond to writeExternal() and readExternal() respectively. An implementation of these methods would write (passivate) or read (activate) the object using appropriate streams from custom locations.

ram.

 
itrahul soni
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey ramprasad madathil
Can you please give more info on Externalizable and how would we use that. If you give an example then it will be more helpful.

Thanks,
Rahul.
 
Sony Agrawal
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for confirming..
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!