1 2 3 Previous Next 33 Replies Latest reply on Nov 10, 2010 2:30 PM by toddpi314 Go to original post
      • 30. Re: 15 gotchas in seam

        This is very important:
        Do not use @Out with Stateless Session Bean or any stateless beans, it could be a memory leak!!!!

        The Stateless session bean is not bound with any context, and it tend to be reused cross different users, Seam BijectionInterceptor doesn't clean up the @Out attribute references after invocation of the method. so the SLSB hold the references until next it called by other users, so even if the context is already invalid, the JVM still think the variable is still being used and can't release it to GC.

        If you configured EJB has max 250 instances, then chances are you may have 250 different copies of attributes should be released and still in the memory for each Stateless EJB.

        To avoid this you can either

        @In(required = false)

        in front of @Out, or use

        ScopeType.CONVERSATION.getContext().set("variable name", variable)

        I prefer the second way, it faster and cleaner.
        This will be more safer and clean (actually it is code I stole from the component method).

        • 31. Re: 15 gotchas in seam

          so, I am getting deep into clustering and I annotated the post below so if you are doing clustering, the last few posts are a MUST read to make your lives 10 times easier.


          1. enable the jdk1.6 property to tell you the object graph when serialization fails

          2. MUST MUST not outject entities!!!  only outject ids which kinda defeats seams whole purpose but unfortunately you risk serializing ALOT of crap you don't want serialized....I moved to all ids and on failover the entities are relooked up from the db avoiding a huge amount of serialization on outjections explained in 3....

          3. when you outject an entity that has eager fetch on lists, those lists will be serialized too...only if you had prefetch or caused a fetch on the list though!!

          all in all, if you are going to cluster, I almost prefer GWT at this point...it was ALOT ALOT less work as the servers were nearly stateless and everything tended to be in the browser page and nothing in the session, which made it easier.  It seems with tomcat, ANYthing you put in the session/conversation will be clustered so I thought seam might only cluster the proxy beans that sit above the entity bean in the session, but that didn't seem to be happening(maybe I am doing something wrong).


          • 32. Re: 15 gotchas in seam

            shucks the problem just got worse.  I was trying to cluster a loaded list of entities for a drop down and they have a field reference to another entity that I don't want clustered and when I make it transient, hibernate complains on startup now.....grrrrrrrr. 

            • 33. Re: 15 gotchas in seam

              5 gotchas as reported by my team members:

              1) Hibernate voodoo just doesn't work, and It should just work!

              2) Seam can't compile javascript to the client like GWT? Geees

              3) Hibernate schema gen can't be used after we are in production? Why can't they make that update things for me?

              4) The Entity Manager doesn't call flush when I want it to! Why can't it tell when I am ready for it to presist?

              5) Seam's UI Library is so 90's. Why can't it design the UX for me!?

              (Yes, this is meant to be funny)

              1 2 3 Previous Next