[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-3983) @Observer methods may be called multiple times

Vanessa Williams (JIRA) jira-events at lists.jboss.org
Mon Mar 2 19:00:22 EST 2009


    [ https://jira.jboss.org/jira/browse/JBSEAM-3983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12455069#action_12455069 ] 

Vanessa Williams commented on JBSEAM-3983:
------------------------------------------

Perhaps I was unclear: there is no @Observer method in the subclass. There is only one instance of that method--in the superclass. There is no event thrown in the subclass, either, it merely extends its parent with some extra methods. It has a @Name so that those methods can be referred to via context variables.

Why the Observer method would be called twice in this case is non-obvious. 

As to the second (independent Observer) not being called due to some error with the first, you have a point.

> @Observer methods may be called multiple times
> ----------------------------------------------
>
>                 Key: JBSEAM-3983
>                 URL: https://jira.jboss.org/jira/browse/JBSEAM-3983
>             Project: Seam
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.1.1.GA
>            Reporter: Vanessa Williams
>            Assignee: Norman Richards
>
> Some @Observer methods may be called multiple times, while others may not be called at all. This bug is reproducible; occurs in both 2.1.0 and 2.1.1 and requires specific circumstances (described below.)
> I do not have the time (unfortunately) to create a sample project to demonstrate the problem, but it is easy enough to describe.
> Create an EntityHome<E> subclass, let's call it FooHome.java. Override the persist() method and at the end of it, raise an event, say "fooSaved". Now, in the same class create a method postFooSaved() and annotate it with @Observer("fooSaved"). In any other component you like, create another @Observer method, with a different name, say watchFoo(), observing the same event. In this case, everything works as expected. After FooHome.persist() is called, postFooSaved() and watchFoo() will each be executed once.
> Now to replicate the bug: create a subclass of FooHome.java, say BarHome.java. It doesn't matter what it contains. Now postFooSaved() will be executed twice and watchFoo() will not be executed at all.
> As an extended demonstration, create an action component called FooAction.java and move the original postFooSaved() @Observer to that class. Again, all will work as expected, with postFooSaved() and watchFoo() each executing once. Now create a subclass of FooAction: BarAction.java. The bug will re-appear, with postFooSaved() executing twice and watchFoo() not executing at all.
> Hope that helps.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list