tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From is_maximum <mnr...@gmail.com>
Subject Re: Question regarding Stateless session beans
Date Thu, 12 Nov 2009 12:44:23 GMT

Thanks, do you know if there is any overhead using stateful SBs? And does
this degrade the performance?
There are many such services and in real word our application may serve more
than 5000 users.



Jean-Louis MONTEIRO wrote:
> 
> Hi,
> 
> In my opinion you are not guaranty to get the same instance of a stateless
> session bean between invocation (a stateful is better for that).
> In OpenEJB the bean instance is retrieved from the pool at the beginning
> of the invocation and returned to the pool at the end of the invocation.
> 
> Jean-Louis
>  
> 
> is_maximum wrote:
>> 
>> Hello
>> 
>> We have a stateless SB with three method: preProcess, process and
>> postProcess
>> Normally when I use this EJB in another SB I call these methods as
>> follows:
>> 
>> public class AnotherEJB {
>> 
>> @EJB
>> private SessionBean sessionBean;
>> 
>>    public void someMethod() {
>>     sessionBean.preProcess();
>>     sessionBean.process();
>>     sessionBean.postProcess();
>>   }
>> 
>> }
>> this works fine and it seems the state of that bean is kept the same. 
>> My question is if a delay occurs between these three methods, will
>> container assign this stateless to another thread to serve incoming
>> request and after this delay say process() method is called it might be
>> another session bean instance? To clarify my question look at following
>> code:
>> 
>> public void someMethod() {
>> 
>>     sessionBean.preProcess();
>> 
>>     //calling another method which takes too long to complete, and during
>> this method container
>>     // is receiving another request in which sessionBean is invoked
>>     doSomethingMassive();
>>     
>>     sessionBean.process(); //is this the same instance of sessionBean
>> that already invoked preProcees() method above?
>> 
>>     perhapsDoSomethingElse(); //another method
>> 
>>     sessionBean.postProcess();
>> 
>> }
>> 
>> 
>> can anyone please help me on this?
>> 
>> }
>> 
>> 
> 
> 


-----
--
Regards

Mohammad Norouzi

Help each other to reach the future faster

http://pixelshot.wordpress.com Pixelshot Photoblog 

http://brainable.blogspot.com Brainable Blog 


-- 
View this message in context: http://old.nabble.com/Question-regarding-Stateless-session-beans-tp26315274p26318014.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


Mime
View raw message