You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by Eric Covener <co...@gmail.com> on 2010/07/18 17:19:39 UTC

Re: EJB contextual reference (our proxy) in creationalContext instead of instance?

On Sat, Jul 17, 2010 at 6:37 PM, Gurkan Erdogdu <gu...@yahoo.com> wrote:
> I think that in your case : RequestScope is ended and @RequestScoped bean is
> destroyed by the container. When this bean instance is destroyed by the
> container, container collects all of its dependencies from CreationalContextImpl
> and destroy all of them. In your case, it seems that this is the Stateful EJB
> instance dependency. To destroy stateful instance, container calls remove
> method.

I'm still confused by this.  Do you agree terminology wise that our
own javasist proxy is a "contextual reference" and that the proxy from
EJB is our (underlying) "contextual instance"?  The latter may or may
not need to be created, based on whether the injected reference is
actually used.  But it seems like we store the contextual reference
itself, instead of the instance, in the dependent creational context.

For EJB at least, wouldn't keeping the contextual reference instead of
the instance cause us to go create EJB's from our context just in
order to @Remove them?  I am not sure if other bean types have enough
going on in the destroyComponentInstance to care too much.

I may be way off in left field, as I am struggling with trying to get
my head around the code.  Any illumination you could provide is much
appreciated!

>         at org.apache.webbeans.sample.ejb.Echo_$$_javassist_3.remove(Echo_$$_javassist_3.java)
>         at org.apache.webbeans.util.ClassUtil.callInstanceMethod(ClassUtil.java:533)
>         at org.apache.webbeans.ejb.common.component.BaseEjbBean.destroyComponentInstance(BaseEjbBean.java:149)
>         at org.apache.webbeans.component.AbstractInjectionTargetBean.destroyInstance(AbstractInjectionTargetBean.java:179)
>         at org.apache.webbeans.component.AbstractOwbBean.destroyCreatedInstance(AbstractOwbBean.java:265)
>         at org.apache.webbeans.portable.creation.InjectionTargetProducer.preDestroy(InjectionTargetProducer.java:135)
>         at org.apache.webbeans.component.InjectionTargetWrapper.preDestroy(InjectionTargetWrapper.java:104)
>         at org.apache.webbeans.component.AbstractOwbBean.destroy(AbstractOwbBean.java:219)
>         at org.apache.webbeans.context.creational.CreationalContextImpl.removeDependents(CreationalContextImpl.java:278)
>         at org.apache.webbeans.context.creational.CreationalContextImpl.release(CreationalContextImpl.java:349)
>         at org.apache.webbeans.component.AbstractOwbBean.destroy(AbstractOwbBean.java:232)

>         at org.apache.webbeans.sample.ejb.Echo_$$_javassist_3.remove(Echo_$$_javassist_3.java)

>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
>         at java.lang.reflect.Method.invoke(Method.java:600)
>         at org.apache.webbeans.util.ClassUtil.callInstanceMethod(ClassUtil.java:533)
>         at org.apache.webbeans.ejb.common.component.BaseEjbBean.destroyComponentInstance(BaseEjbBean.java:149)
>         at org.apache.webbeans.component.AbstractInjectionTargetBean.destroyInstance(AbstractInjectionTargetBean.java:179)

-- 
Eric Covener
covener@gmail.com

Re: EJB contextual reference (our proxy) in creationalContext instead of instance?

Posted by Gurkan Erdogdu <gu...@yahoo.com>.
>>>I'm still confused by this.  Do you agree terminology wise that our
>>>own  javasist proxy is a "contextual reference" and that the proxy from
>>>EJB  is our (underlying) "contextual instance"? 
Yes.

>>>For EJB at least, wouldn't keeping the contextual reference instead of
>>>the  instance cause us to go create EJB's from our context just in
>>>order  to @Remove them?  I
All of the things are done using contextual reference, including calling 
@Remove. Thing is that
Altough it is someway ridicilous, any method is called follows the below 
execution path, 


Context Ref --> EJB Proxy Instance --> EJB Instance


Gurkan


________________________________
From: Eric Covener <co...@gmail.com>
To: dev@openwebbeans.apache.org
Sent: Sun, July 18, 2010 6:19:39 PM
Subject: Re: EJB contextual reference (our proxy) in creationalContext instead  
of instance?

On Sat, Jul 17, 2010 at 6:37 PM, Gurkan Erdogdu <gu...@yahoo.com> wrote:
> I think that in your case : RequestScope is ended and @RequestScoped bean is
> destroyed by the container. When this bean instance is destroyed by the
> container, container collects all of its dependencies from 
>CreationalContextImpl
> and destroy all of them. In your case, it seems that this is the Stateful EJB
> instance dependency. To destroy stateful instance, container calls remove
> method.

I'm still confused by this.  Do you agree terminology wise that our
own javasist proxy is a "contextual reference" and that the proxy from
EJB is our (underlying) "contextual instance"?  The latter may or may
not need to be created, based on whether the injected reference is
actually used.  But it seems like we store the contextual reference
itself, instead of the instance, in the dependent creational context.

For EJB at least, wouldn't keeping the contextual reference instead of
the instance cause us to go create EJB's from our context just in
order to @Remove them?  I am not sure if other bean types have enough
going on in the destroyComponentInstance to care too much.

I may be way off in left field, as I am struggling with trying to get
my head around the code.  Any illumination you could provide is much
appreciated!

>         at 
>org.apache.webbeans.sample.ejb.Echo_$$_javassist_3.remove(Echo_$$_javassist_3.java)
>
>         at 
>org.apache.webbeans.util.ClassUtil.callInstanceMethod(ClassUtil.java:533)
>         at 
>org.apache.webbeans.ejb.common.component.BaseEjbBean.destroyComponentInstance(BaseEjbBean.java:149)
>
>         at 
>org.apache.webbeans.component.AbstractInjectionTargetBean.destroyInstance(AbstractInjectionTargetBean.java:179)
>
>         at 
>org.apache.webbeans.component.AbstractOwbBean.destroyCreatedInstance(AbstractOwbBean.java:265)
>
>         at 
>org.apache.webbeans.portable.creation.InjectionTargetProducer.preDestroy(InjectionTargetProducer.java:135)
>
>         at 
>org.apache.webbeans.component.InjectionTargetWrapper.preDestroy(InjectionTargetWrapper.java:104)
>
>         at 
>org.apache.webbeans.component.AbstractOwbBean.destroy(AbstractOwbBean.java:219)
>         at 
>org.apache.webbeans.context.creational.CreationalContextImpl.removeDependents(CreationalContextImpl.java:278)
>
>         at 
>org.apache.webbeans.context.creational.CreationalContextImpl.release(CreationalContextImpl.java:349)
>
>         at 
>org.apache.webbeans.component.AbstractOwbBean.destroy(AbstractOwbBean.java:232)

>         at 
>org.apache.webbeans.sample.ejb.Echo_$$_javassist_3.remove(Echo_$$_javassist_3.java)
>

>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
>         at 
>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
>
>         at java.lang.reflect.Method.invoke(Method.java:600)
>         at 
>org.apache.webbeans.util.ClassUtil.callInstanceMethod(ClassUtil.java:533)
>         at 
>org.apache.webbeans.ejb.common.component.BaseEjbBean.destroyComponentInstance(BaseEjbBean.java:149)
>
>         at 
>org.apache.webbeans.component.AbstractInjectionTargetBean.destroyInstance(AbstractInjectionTargetBean.java:179)
>

-- 
Eric Covener
covener@gmail.com