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

Jason Porter (JIRA) jira-events at lists.jboss.org
Sun May 8 11:29:18 EDT 2011


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

Jason Porter commented on CDI-4:
--------------------------------

Maybe I'm coming at this from an odd angle, but why not allow them to register, via the same service provider API, a Comparator<InjectionPoint> or Comparator<ObserverMethod>? We could leave everything the way it is or create a default one that just returns 0. This allows the users complete control over where each observer falls in the set of observers, they don't need to add more XML, it's a very simply, widely used pattern for ordering. Not sure why we're trying to reinvent an ordering solution when one has already been provided by the language.

> 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: Mike 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