7 Replies Latest reply on Nov 18, 2009 8:55 PM by nickarls

    conversation begin and end semantics

    asookazian

      from weld-ref: To promote the conversation associated with the current request to a long-running conversation, call the begin() method from application code. To schedule the current long-running conversation context for destruction at the end of the current request, call end().


      I thought in Seam the temp conv is promoted to LRC at the end of a successful method execution (i.e. no RuntimeException), not at the end of the current request.


      Does current request mean JSF HTTP GET/POST request or does it mean method execution?


      I still find it strange, with all these annotations in CDI, that @Begin and @End are missing.  It's like removing CMT from EJB and leaving you with BMT...  Yes, it'll be there in Seam3....  But this BMC style requires an add'l line of code to @Inject the Conversation instance, no? 


      How can we pre-configure an injection of Conversation instance?  extending an abstract class or what?

        • 1. Re: conversation begin and end semantics

          Arbi Sookazian wrote on Nov 18, 2009 18:47:


          from weld-ref: To promote the conversation associated with the current request to a long-running conversation, call the begin() method from application code. To schedule the current long-running conversation context for destruction at the end of the current request, call end().

          I thought in Seam the temp conv is promoted to LRC at the end of a successful method execution (i.e. no RuntimeException), not at the end of the current request.


          AFAIK in Seam Conversations only die (or not) at the end of requests... if you promote one from temp to long, all you are saying is I don't want this conversation to die at the end of the request and, when you call end you are going back to the default behavior of letting it die at the end of the request. That is, IMO what Weld does too.



          Does current request mean JSF HTTP GET/POST request or does it mean method execution?


          IMO it means method execution.



          I still find it strange, with all these annotations in CDI, that @Begin and @End are missing.  It's like removing CMT from EJB and leaving you with BMT...  Yes, it'll be there in Seam3....  But this BMC style requires an add'l line of code to @Inject the Conversation instance, no? 


          IMO you could write an interceptor that recognized your own ArbiBegin and ArbiEnd annotations and did exactly that... of course, that does not explain why that interceptor is not already included in Weld.



          How can we pre-configure an injection of Conversation instance?  extending an abstract class or what?


          Mmmm? I don't understand what you are asking here...

          • 2. Re: conversation begin and end semantics

            Francisco Peredo wrote on Nov 18, 2009 19:45:


            IMO it means method execution.



            Correction: IMO it means request not method execution. Sorry for the mistake, someone distracted me here.

            • 3. Re: conversation begin and end semantics
              asookazian

              Francisco Peredo wrote on Nov 18, 2009 19:45:



              How can we pre-configure an injection of Conversation instance?  extending an abstract class or what?


              Mmmm? I don't understand what you are asking here...


              In Weld, I don't want to write the injection for the Conversation (that line of code) for every class that needs it (this is required for BMC, remember).  So maybe an abstract class can be extended that already has that injection to cut down on code??

              • 4. Re: conversation begin and end semantics
                nickarls

                Put common injections in superclass


                @Begin/@End is for frameworks


                the begin() is just flipping a flag in the conversation so the conv.man. knows what to (not) do with it when the conversation ends.

                • 5. Re: conversation begin and end semantics

                  Nicklas Karlsson wrote on Nov 18, 2009 20:12:


                  the begin() is just flipping a flag in the conversation so the conv.man. knows what to (not) do with it when the conversation ends.


                  Shouldn't that be:


                  he begin() is just flipping a flag in the conversation so the conversation manager knows what to do (end or not the conversation) when the request ends.


                  • 6. Re: conversation begin and end semantics
                    nickarls

                    You're correct, of course. Too many postings in too short a time...

                    • 7. Re: conversation begin and end semantics
                      nickarls

                      (any my first attempt at posting it died at a MySQL lock)