Session-scope objects often Serializable

Although not required, it's sometimes helpful if objects placed in session scope implement Serializable. Some would do this only if necessary, since implementing Serializable is not trivial.

This allows the servlet container to either store the contents of a session on disk, or to transfer session contents over the network to another server.

In the case of a restart, the web container may attempt to implement a "failover" strategy by attempting to serialize all data stored in session scope, in order to recover the data after the restart has completed - this will work only if such data implements Serializable.

See Also :
Implementing Serializable
Loss of data during restart
Would you use this technique?
Yes   No   Undecided   
© 2014 Hirondelle Systems | Source Code | Contact | License | RSS
Individual code snippets can be used under this BSD license - Last updated on September 21, 2013.
Over 2,000,000 unique IPs last year - Built with WEB4J.
- In Memoriam : Bill Dirani -