[weld-issues] [JBoss JIRA] (WELD-1016) Weld creates multiple interceptor instances per target instance

Marko Lukša (JIRA) jira-events at lists.jboss.org
Fri Mar 16 02:54:48 EDT 2012


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

Marko Lukša commented on WELD-1016:
-----------------------------------

Fixed in 1.2. Needs merge into 2.0.

                
> Weld creates multiple interceptor instances per target instance
> ---------------------------------------------------------------
>
>                 Key: WELD-1016
>                 URL: https://issues.jboss.org/browse/WELD-1016
>             Project: Weld
>          Issue Type: Bug
>          Components: Interceptors and Decorators
>    Affects Versions: 1.1.2.Final
>            Reporter: Jozef Hartinger
>            Assignee: Marko Lukša
>             Fix For: 1.2.0.Beta1, 2.0.0.Final
>
>
> The CDI spec says:
> {quote}
> An interceptor instance is a dependent object of the object it inter-cepts.
> {quote}
> The Interceptors spec says:
> {quote}
> The lifecycle of an interceptor instance is the same as that of the target class instance with which it
> is associated. When the target instance is created, a corresponding interceptor instance is created for
> each associated interceptor class. These interceptor instances are destroyed when the target instance
> is removed.
> {quote}
> and also
> {quote}
> An interceptor instance may hold state.
> {quote}
> It is clear that at most one instance of an interceptor class should be created for an instance of a CDI bean. However, Weld currently creates an instance per method per target instance.
> Having a simple intercepted bean:
> {code:JAVA}
> @ApplicationScoped
> @LionBinding
> public class Lion
>     public Object foo() {
>         return null;
>     }
>     public Object bar() {
>         return null;
>     }
> }
> {code}
> * multiple invocations of a single method (e.g. foo()) are intercepted by the same interceptor instance
> * when invoking different methods on the same bean instance, every method is intercepted by a different interceptor instance - which is wrong

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the weld-issues mailing list