File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Serializable domain objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Serializable domain objects" Watch "Serializable domain objects" New topic
Author

Serializable domain objects

Andrei Antonescu
Ranch Hand

Joined: Jul 08, 2010
Posts: 75
Hello,
Can you please explain why is it best practice to serialize the Plain Old Java Objects we use in a Java Web App?

Thanks in advance
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

It is often for scalability. You put the Objects into a Context, and they hang around for a while. As your server starts to get more hits, it will eat up more memory. Since not all the Objects that were created are in active use, then some of them can be Serialized to disk to get them out of RAM, and make way for more use. Then when those Objects are needed again they are Deserialized and put into action.

Another scalability factor is Clustering. When your site starts to get a lot of hits, and resources start to become an issue you can deploy your application on a Cluster. In this case you may have several Servers running the same application - and they will need access to the same data. So the servers can serialize the Objects and pass them from one node in the Cluster to another.


Steve
Andrei Antonescu
Ranch Hand

Joined: Jul 08, 2010
Posts: 75
Thanks Steve. That is a very good point.
 
 
subject: Serializable domain objects