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 :
Would you use this technique?