You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by David Blevins <da...@visi.com> on 2010/01/21 17:08:55 UTC

Programmatic Stateful bean removal (Re: EJB 3.1 additions)

Also moved to a new thread.

On Jan 21, 2010, at 8:27 AM, Gurkan Erdogdu wrote:

> Hi David;
>
> I would also like to help on JCDI integration :)

What!?  I'm shocked.  Never would have guessed ;)

Anyway, a critical piece we'll need for the integration is some way  
that the @Scope manager (OWB) can remove Stateful beans even though  
these beans may not have a remove method.  The best way to do this is  
to craft up something a bit like the old 2.1 days when there was a  
standard remove method on every EJB proxy.

We add this interface to every proxy:   
org.apache.openejb.core.ivm.IntraVmProxy

In the simplest case, we just add a remove() method to that guy.   
Maybe more elegantly, we make a new interface just for this directly  
under the org.apache.openejb package and maybe have the IntraVmProxy  
interface just extend it.

The "_invoke" method of the EjbHomeProxyHandler would be coded to  
ignore the remove method.  The "_invoke" method of the  
"EjbObjectProxyHandler" would be coded to spot it and then call the  
"remove(...)" method of the EjbObjectProxyHandler just like it would  
do for an EJBObject.remove call.

We might have to pass a different method instance into that remove  
method for it work.  Likely it will have to be an instance of either  
the EJBLocalObject.remove method or the EJBObject.remove method for  
the container to understand it.

That's the general idea anyway.  Something along these lines should  
work.

-David


Re: Programmatic Stateful bean removal (Re: EJB 3.1 additions)

Posted by David Blevins <da...@visi.com>.
On Jan 22, 2010, at 7:53 AM, Gurkan Erdogdu wrote:

>>>> What!?  I'm shocked.  Never would have guessed ;)
> lol
>
>>>> @Scope manager (OWB) can remove Stateful beans e....
> Currently we use this code in EJBBean to create session object  
> proxies;
>
> String jndiName = "java:openejb/Deployment/" +
> JndiBuilder.format(deploymentInfo.getDeploymentID(),
> this.iface.getName());
> Object object = onctext.lookup(jndiName)
>
> If this proxy provide remove() method, we may call it using  
> reflection.

Right, exactly.

-David


>
> 2010/1/21 David Blevins <da...@visi.com>
>
>> Also moved to a new thread.
>>
>> On Jan 21, 2010, at 8:27 AM, Gurkan Erdogdu wrote:
>>
>> Hi David;
>>>
>>> I would also like to help on JCDI integration :)
>>>
>>
>>
>> Anyway, a critical piece we'll need for the integration is some way  
>> that
>> the @Scope manager (OWB) can remove Stateful beans even though  
>> these beans
>> may not have a remove method.  The best way to do this is to craft up
>> something a bit like the old 2.1 days when there was a standard  
>> remove
>> method on every EJB proxy.
>>
>> We add this interface to every proxy:
>> org.apache.openejb.core.ivm.IntraVmProxy
>>
>> In the simplest case, we just add a remove() method to that guy.   
>> Maybe
>> more elegantly, we make a new interface just for this directly  
>> under the
>> org.apache.openejb package and maybe have the IntraVmProxy  
>> interface just
>> extend it.
>>
>> The "_invoke" method of the EjbHomeProxyHandler would be coded to  
>> ignore
>> the remove method.  The "_invoke" method of the  
>> "EjbObjectProxyHandler"
>> would be coded to spot it and then call the "remove(...)" method of  
>> the
>> EjbObjectProxyHandler just like it would do for an EJBObject.remove  
>> call.
>>
>> We might have to pass a different method instance into that remove  
>> method
>> for it work.  Likely it will have to be an instance of either the
>> EJBLocalObject.remove method or the EJBObject.remove method for the
>> container to understand it.
>>
>> That's the general idea anyway.  Something along these lines should  
>> work.
>>
>> -David
>>
>>
>
>
> -- 
> Gurkan Erdogdu
> http://gurkanerdogdu.blogspot.com


Re: Programmatic Stateful bean removal (Re: EJB 3.1 additions)

Posted by Gurkan Erdogdu <cg...@gmail.com>.
>>>What!?  I'm shocked.  Never would have guessed ;)
lol

>>>@Scope manager (OWB) can remove Stateful beans e....
Currently we use this code in EJBBean to create session object proxies;

String jndiName = "java:openejb/Deployment/" +
JndiBuilder.format(deploymentInfo.getDeploymentID(),
this.iface.getName());
Object object = onctext.lookup(jndiName)

If this proxy provide remove() method, we may call it using reflection.

Thanks;

--Gurkan

2010/1/21 David Blevins <da...@visi.com>

> Also moved to a new thread.
>
> On Jan 21, 2010, at 8:27 AM, Gurkan Erdogdu wrote:
>
>  Hi David;
>>
>> I would also like to help on JCDI integration :)
>>
>
>
> Anyway, a critical piece we'll need for the integration is some way that
> the @Scope manager (OWB) can remove Stateful beans even though these beans
> may not have a remove method.  The best way to do this is to craft up
> something a bit like the old 2.1 days when there was a standard remove
> method on every EJB proxy.
>
> We add this interface to every proxy:
>  org.apache.openejb.core.ivm.IntraVmProxy
>
> In the simplest case, we just add a remove() method to that guy.  Maybe
> more elegantly, we make a new interface just for this directly under the
> org.apache.openejb package and maybe have the IntraVmProxy interface just
> extend it.
>
> The "_invoke" method of the EjbHomeProxyHandler would be coded to ignore
> the remove method.  The "_invoke" method of the "EjbObjectProxyHandler"
> would be coded to spot it and then call the "remove(...)" method of the
> EjbObjectProxyHandler just like it would do for an EJBObject.remove call.
>
> We might have to pass a different method instance into that remove method
> for it work.  Likely it will have to be an instance of either the
> EJBLocalObject.remove method or the EJBObject.remove method for the
> container to understand it.
>
> That's the general idea anyway.  Something along these lines should work.
>
> -David
>
>


-- 
Gurkan Erdogdu
http://gurkanerdogdu.blogspot.com