tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Sébastien Scrève <>
Subject Re: How to remove stateful sessions programmatically ?
Date Mon, 20 Oct 2008 09:21:46 GMT

Well, I don't see any simple way of doing it.

I'm gonna do like in Seam : lookup for a method annotated @Remove with no
parameters and call it if present.

Best regards,

Jean-Sebastien Screve.

David Blevins wrote:
> On Oct 17, 2008, at 1:49 PM, David Blevins wrote:
>> On Oct 17, 2008, at 5:57 AM, Jean-Sébastien Scrève wrote:
>>> Hi all,
>>> I'd like to remove stateful sessions beans by calling a method from  
>>> OpenEJB
>>> itself and I don't see how I can do that.
>>> I don't want to call a method with @Remove annotation because I did  
>>> not
>>> create the stateful myself.
>>> Is there a way I can do that ?
>>> More generally, how I can interact with the container at runtime ?
>> If the bean had a 2.x home/remote interface that'd be easy as you  
>> could call remove on the home interface and pass in the stateful  
>> bean reference.  Aside from that, not sure it can be done.  The code  
>> we have for removing stateful beans is very much tied to the  
>> invoking of the remove method, calling the predestroy methods of the  
>> interceptors and bean, taking care of the transaction settings for  
>> the method, handling the exceptions thrown from the method, etc.  We  
>> don't have a second way to remove stateful beans.
>> The only other way I can think of is via an interceptor.  If an  
>> interceptor method throws a runtime exception then the bean is  
>> destroyed.
> Feel free to elaborate on the use case.  Might be an alternate way of  
> looking at the problem that could also solve the issue.
> -David

View this message in context:
Sent from the OpenEJB User mailing list archive at

View raw message