-
1. Re: Seam POJO, serializable or not ?
swd847 Apr 4, 2009 12:44 AM (in response to gjeudy)It depends if you want to cluster the http session or not. The app will run fine otherwise.
-
2. Re: Seam POJO, serializable or not ?
gonorrhea Apr 4, 2009 12:47 AM (in response to gjeudy)The conversation scope is a managed space in the HttpSession space. It's best to follow the recommendations and implement the java.io.Serializable marker interface when considering conversation-scoped JavaBeans.
Here's an excerpt from Seam in Action:
Let’s consider another difficult scenario that’s cleared up thanks to the dynamic nature of Seam’s DI: mixing nonserializable objects with serializable objects (a serializable object is an instance of any class that implements java.io.Serializable). If a nonserializable object is injected into the property of a serializable session-scoped object, and that property isn’t cleared prior to session passivation, the session storage mechanism will get tripped up by the nonserializable data. You could, of course, mark the field as transient so that the value would be automatically cleared, hence allowing the session to properly passivate. However, the real problem is that once the session is restored, the transient field remains null, acting as a land mine in the form of a NullPointerException that may be triggered by an unsuspecting block of code.
My understanding is that if the container does not passivate HttpSessions then we don't need Seam POJOs to be Serializable.why would you want a container or configure a container to not passivate SFSB's to disk? Each client requires its own SFSB, so it's in your best interest to have the container passivate SFSBs based on an algorithm like LRU or MRU, etc. This is one of the advantages of using a JEE app server like JBoss, WebLogic, etc.
The bottom line is if you're sure you are not going to be using any EJBs at all, then perhaps you don't need to implement Serializable interface. If you're going to be using JavaBeans and EJBs, then follow the rules...
-
3. Re: Seam POJO, serializable or not ?
gonorrhea Apr 4, 2009 12:51 AM (in response to gjeudy)
Stuart Douglas wrote on Apr 04, 2009 00:44:
It depends if you want to cluster the http session or not. The app will run fine otherwise.this is a good way to summarize it. state replication requires shuttling data across the wire (over your LAN/WAN) so your classes must implement Serializable otherwise state can't be replicated from node to node.
most production systems will require some sort of clustering (say a 2 node horz cluster) and thus you should follow the rules if you have non-functional requirements like fault tolerance, performance, failover, scalability, etc.
-
4. Re: Seam POJO, serializable or not ?
gjeudy Apr 7, 2009 10:04 PM (in response to gjeudy)Right, I understand the rules for SFSBs but i'm not using them. The rational behind making Seam POJOs Serializable is pretty clear to me now.
Thanks Guys!