Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session Listeners

 
Abhisar Singh
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

can somebody describe to me the following ...

Attributes of a session that implements java.io.serializable interface are migrated appropriately when the session migrates. This dose not mean that if the attribute implements the readObject() and writeObject() methods they will definitely be called........
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think there is any hidden meaning behind this.
The attributes will be properly migrated, but the container may choose different ways to do it. So you must not think that it will call readObject or writeObject. It may not.
 
Abhisar Singh
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Thanks Satou kurinosuke

dose that means that if we try and save attributes on a FILE they wont be saved...becoz the readObject() & writeObject() may not be called...
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exactly. If you've overriden those methods to do some saving/restoring, it will not necessarily be called.
 
Flom Xanther
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To be absolute sure:

Developers are not
guaranteed that containers will call readObject and writeObject methods on
session attributes if they implement them, but are guaranteed that the
Serializable closure of their attributes will be preserved.


Servlet spec. 7.7.2

Mfg,
Flom
 
Abhisar Singh
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi thanks I just got confused but now its OK....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic