8 Replies Latest reply on Nov 21, 2006 4:03 PM by antispart

    Concerning nested conversation

    antispart

      Does calling an @End annotated method on an outer conversation guarantee that all nested conversations will be killed?

      I'm trying to use nested conversations to manage a hierarchy of selections (perhaps I shouldnt use conversations for this?) and am finding problems with nested conversations living past their parent conversation (or at least that seems to be the issue).

      Example

      select category A - first conversation
      select subcategory B - nested conversation
      select sub-subcategory C - 2nd nested conversation

      call @End deselect subcategory B
      -> this kills conversation B and C

      so now only A is selected.

      I'm having issues where C will stay selected even after deselecting B. 1.1.0 CR1 solved some issues I was having with this, some issues still persist and I'm wondering if I should not use conversations to manage this type of thing or if perhaps there's something else wrong.

        • 1. Re: Concerning nested conversation
          gavin.king

           

          Does calling an @End annotated method on an outer conversation guarantee that all nested conversations will be killed?


          Yes.

          • 2. Re: Concerning nested conversation
            gavin.king

             

            1.1.0 CR1 solved some issues I was having with this


            There was a bug in previous versions that meant that if you encountered @Begin(join=true) after @End, the nested conversation stayed alive.

            http://jira.jboss.com/jira/browse/JBSEAM-511

            • 3. Re: Concerning nested conversation
              gavin.king

              BTW, the debug page will show you exactly what long-running conversations exist.

              • 4. Re: Concerning nested conversation
                antispart

                It looks like what's happening is that when an @End annotated method is encountered the deepest level (most nested) conversation gets killed, not necessarily the one started on the same SFSB.

                So if I have

                public class A {
                @Begin (nested=true)
                selectA()
                
                @End
                deselectA()
                }


                public class B {
                @Begin (nested=true)
                selectB()
                
                @End()
                deselectB
                }


                public class C {
                @Begin (nested=true)
                selectC
                
                @End
                deselectC}
                


                And I call
                selectA()
                selectB()
                selectC()
                deselectB()

                Only the last conversation is being killed (the one started in selectC().

                Is there any way to specify that you want to kill the conversation started on the same SFSB (and therefore all nested conversation as well)? So, deselectB would kill the conversations started by selectB and selectC. Also, deselectA would kill the conversations started by selectA, selectB, selectC.

                The alternative is just to call deselectC from deselectB, but I think it'd be more clean for that to be handled transparently.

                Thanks.



                • 5. Re: Concerning nested conversation
                  gavin.king

                  Correct. @End ends the *current* (ie most nested conversation). Conversations are not tied to an instance of a Seam component.

                  • 6. Re: Concerning nested conversation
                    antispart

                    Thanks very much. It does make more sense this way actually =-).

                    • 7. Re: Concerning nested conversation
                      antispart

                      Going back to my previous example:

                      @End
                      deselectA() {
                       deselectB();
                      }
                      
                      @End
                      deselectB() {
                       ...
                      }


                      It seems that calling deselectA() will only kill the nested most conversation, but when it then calls deselectB() the 2nd conversation is not killed (even though the method is annotated with @End.

                      Is this a bug, or is there another way to kill the 2nd conversation?

                      • 8. Re: Concerning nested conversation
                        antispart

                        Took a look at the API and found:

                        Conversation.instance().pop();

                        Still, it'd be nice if the @End annotation could take care of this. In my case I removed the @End annotation and am using pop() instead - so far the behavior looks good, but I'm not sure that this is the preferred pattern?