[cdi-dev] [JBoss JIRA] (CDI-458) Give the possibility to deactivate an observer in ProcessObserverMethod

Martin Kouba (JIRA) issues at jboss.org
Wed Sep 17 07:17:02 EDT 2014

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

Martin Kouba commented on CDI-458:

Looks like a good idea. However, we should also clarify that POM is not fired for container lifecycle events. Although it makes sense it's not explicitly stated anywhere. Furthermore, it's not clear whether POM is fired for *non-container lifecycle events* declared on an extension (AFAIK Weld does not fire POM, nor PIP, for these).

Note that "11.5. Container lifecycle events":
Service providers may have observer methods, which *may observe any event*, including any container lifecycle event, and obtain an injected BeanManager reference...
and "12.4.3. Bean discovery":
For each enabled bean, the container must search the class for observer methods, and for each observer method:
* ...
* fire an event of type ProcessObserverMethod, as defined in ProcessObserverMethod event.

> Give the possibility to deactivate an observer in ProcessObserverMethod
> -----------------------------------------------------------------------
>                 Key: CDI-458
>                 URL: https://issues.jboss.org/browse/CDI-458
>             Project: CDI Specification Issues
>          Issue Type: Feature Request
>          Components: Events, Portable Extensions
>    Affects Versions: 1.2.Final
>            Reporter: Antoine Sabot-Durand
>             Fix For: 2.0 (discussion)
> Today if a user want to deactivate an observer at deployment time, she needs to observes {{ProcessAnnotatedType}} with {{@WithAnnotation(Observes.class)}} and replace the annotatedType by a new one without the {{@Observes}} annotation. It's quite heavy to manage.
> We could add a {{veto()}} method in {{ProcessObserverMethod}} to do this in a far easier and intuitive way. 

This message was sent by Atlassian JIRA

More information about the cdi-dev mailing list