ejb@glassfish.java.net

Re: : stateful EJB

From: Mahesh Kannan <Mahesh.Kannan_at_Sun.COM>
Date: Wed, 13 Jan 2010 20:50:31 -0800

Are you using browser tabs? Are you caching the ejb reference in HTTP
Session?

--Mahesh


נחום מורדוכוביץ
 wrote:
> *Thanks,*
> *I wrote a simple stateful ejb that store int number and two methods
> getNumber() and setNumber(int x),*
> i'm calling the ejb from two separate sessions (two browsers)
> and if i set the number from first session i can see it from next
> session by calling getNumber().
> By your answer I understand it should not be so ?
>
> On Thu, Jan 14, 2010 at 03:26, Dies Koper <diesk_at_fast.au.fujitsu.com
> <mailto:diesk_at_fast.au.fujitsu.com>> wrote:
>
> Ah, I (mis?)read it as "the same instance EACH time".
> If so:
>
>
> >> i get the same instance time ?
>
> No, a new EJB instance will be instantiated to serve your request.
>
>
> >> Are every new session make a new instance of stateful ejb ?
>
> Yes. Stateless EJB instances are pooled (i.e. reused), but
> stateful instances are not.
>
> Regards,
> Dies
>
>
>
> On 14/01/2010 12:15, Marina Vatkina wrote:
>
> What is the instance time that you are looking at?
>
> thanks,
> -marina
>
> נחום מורדוכוביץ wrote:
>
> *
> *
> *hi,
> *
> *I started recently to study EJB,*
> I wrote a small program, a stateful ejb with two business
> methods,
> getX() and increaseX()
> my question is whay when i call the ejb from more then one
> session
> (Different browsers)
> i get the same instance time ?
> Are every new session make a new instance of stateful ejb ?
>
> thank you
> nahummor
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ejb-unsubscribe_at_glassfish.dev.java.net
> <mailto:ejb-unsubscribe_at_glassfish.dev.java.net>
> For additional commands, e-mail: ejb-help_at_glassfish.dev.java.net
> <mailto:ejb-help_at_glassfish.dev.java.net>
>
>