8 Replies Latest reply on Nov 13, 2009 12:38 AM by gavin.king

    Synchronized beans

    swd847

      I just had a quick look through the spec and I could not see anything about synchronizing access to beans, is this something that Seam 3 will address or have I missed something?

        • 1. Re: Synchronized beans
          asookazian

          aren't conversation-scoped beans serialized or synchronized in Seam 2.x?



          Seam serializes processing of concurrent requests that take place in the same long-running
          conversation context, in the same process.

          see section 4.1.4. Conversation context of Seam ref doc...


          but good question.

          • 2. Re: Synchronized beans
            asookazian

            btw, i'm glad somebody is reading the spec. :)

            • 3. Re: Synchronized beans
              swd847

              Yes, but I want to know if this is part of the core weld functionality, or something that seam 3 will add on. Not just with regard to serialization  of conversation access, but also the automatic synchronization of session scoped beans.

              • 4. Re: Synchronized beans
                asookazian

                so otherwise the programmer will have to deal with synchronization code in a multi-threaded environment like synchronized(this).  This type of code was not required AFAIK in Seam programming.


                Thread-safety is something that the EJB component model offers out-of-the-box for session beans.  I'd imagine Weld/CDI would do the same...


                good question, I'm interested in the official answer...

                • 5. Re: Synchronized beans
                  gavin.king

                  Stuart Douglas wrote on Nov 12, 2009 22:18:


                  I just had a quick look through the spec and I could not see anything about synchronizing access to beans, is this something that Seam 3 will address or have I missed something?


                  Yes, I'm sure Seam3 will provide an interceptor for this. Note that EJB 3.1 also features some sophisticated concurrency primitives  - that evolved from my suggestions to the EG ;-)

                  • 6. Re: Synchronized beans
                    asookazian

                    wait. wasn't there a recent thread here in which you or Nicklas stated that interceptors will not be available in Weld or Seam 3?  So the @BypassInterceptors annotation would no longer be required as a performance optimization?

                    • 7. Re: Synchronized beans
                      swd847

                      They did not say that they will not be available, they form part of the CDI spec. The main difference is that all injections no longer have to be done on all method invocations, so the old seam bijection interceptor is no longer needed. There will still be interceptors, you need them to implement things like @Transactional.

                      • 8. Re: Synchronized beans
                        gavin.king

                        Right, the difference is that there are no interceptors by default.