[cdi-dev] [JBoss JIRA] (CDI-457) Add a disposable interface

Mark Struberg (JIRA) issues at jboss.org
Mon Sep 8 02:16:04 EDT 2014

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

Mark Struberg commented on CDI-457:

Please let me ask one question: why should the container know about dependent scoped beans which are _not_ injected into some normalscoped bean? We do not spare any resources for them (at least in OWB). Even if they have interceptors or decorators applied.

Btw, there is kind off such a mechanism already. All you need to do is to keep the Bean<T> and the CreationalContext you used to create the contextual instance. Then just use Bean.destroy(T, cc);

> Add a disposable interface
> --------------------------
>                 Key: CDI-457
>                 URL: https://issues.jboss.org/browse/CDI-457
>             Project: CDI Specification Issues
>          Issue Type: Feature Request
>          Components: Contexts
>            Reporter: John Ament
>            Assignee: John Ament
> Currently for Dependent scoped beans, there's no way for the container to be aware when it's no longer needed.
> I suggest that we somehow wrap dependent beans in a Disposable wrapper to be notified when it's not needed any longer.

This message was sent by Atlassian JIRA

More information about the cdi-dev mailing list