Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

why to use serializable with java bean

/*
One good reason, with respect to servlets, is that if you put 
serializable beans into your web server session, your web server can 
serialize them to disk if it's shutting down, and then deserialize them 
back into memory when it starts up. In this way, users wouldn't lose 
their sessions / logins when the server comes back up.
  
If there are any non-serializable beans in session, tomcat will fail to 
serialize sessions to disk.
I believe it's also necessary if you want to sync sessions between 
multiple servers in a cluster.
*/
 
PREVIOUS NEXT
Tagged: #serializable #java #bean
ADD COMMENT
Topic
Name
4+3 =