[cdi-dev] [JBoss JIRA] Issue Comment Edited: (CDI-4) Need a way to provide ordering for Event observers (@Observes)

Mark Struberg (JIRA) jira-events at lists.jboss.org
Sat May 7 13:31:18 EDT 2011


    [ https://issues.jboss.org/browse/CDI-4?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12600508#comment-12600508 ] 

Mark Struberg edited comment on CDI-4 at 5/7/11 1:31 PM:
---------------------------------------------------------

As with every solution there are pros and cons. Your solution is very neat to read, but there are also a few cons which should not be unmentioned:

a) This solution might introduce cycles in more complex scenarios
b) In a more modular and thus more complex situation, you don't always know your other observers. 
c) Having to know other observers is a bit (*edit*: should better say totally?) against the basic idea of the observer design pattern.
d) Again: if I know my other observers, then just fu***n simply call them directly ;)
e) If I _don't_ know the other observers (e.g. they are in another jar which is not compile time scoped but only added at runtime), then there's now way to do it.

I know: a Float with a default value of 1.0f is really stone age technology. But it works. But sure, this also has cons so lets discuss this further.


      was (Author: struberg):
    As with every solution there are pros and cons. Your solution is very neat to read, but there are also a few cons which should not be unmentioned:

a) This solution might introduce cycles in more complex scenarios
b) In a more modular and thus more complex situation, you don't always know your other observers. 
c) Having to know other observers is a bit against the basic idea of the observer design pattern.
d) Again: if I know my other observers, then just fu***n simply call them directly ;)
e) If I _don't_ know the other observers (e.g. they are in another jar which is not compile time scoped but only added at runtime), then there's now way to do it.

I know: a Float with a default value of 1.0f is really stone age technology. But it works. But sure, this also has cons so lets discuss this further.

  
> Need a way to provide ordering for Event observers (@Observes)
> --------------------------------------------------------------
>
>                 Key: CDI-4
>                 URL: https://issues.jboss.org/browse/CDI-4
>             Project: CDI Specification Issues
>          Issue Type: Feature Request
>          Components: Events, Portable Extensions
>    Affects Versions: 1.0
>         Environment: All
>            Reporter: Lincoln Baxter III
>            Assignee: Christopher Brock
>             Fix For: TBD
>
>
> There needs to be a way to specify some kind of ordering for Event observers. 
> Understandably, this is somewhat counter-intuitive to the general concept of observing an event, but there is going to be need for this in an upcoming JBoss project. While it can be done manually, it might be nice to have a built-in API.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the cdi-dev mailing list