dev@glassfish.java.net

Re: Very Important Question

From: Craig L Russell <Craig.Russell_at_Sun.COM>
Date: Wed, 05 Jul 2006 16:17:27 -0700

Hi Dyego,

On Jul 5, 2006, at 3:15 PM, Dyego Souza Dantas Leal wrote:

> Hello !!!
>
> I have a EJB Application on my GlassFish Server
>
> In my client Swing i call the "TestSessionBean STATELESS" on Server...
>
> The GlassFish creates to me a SessionBean and execute the operation :
>
> for example mySessionRemote.ping()
>
> the Question is :
>
> The GlassFish reuses this session bean to other app ( ex: second
> client calling .ping() 10 seconds after me )

Yes. Stateless session beans are pooled on the server and
indiscriminately used to service any and all requests (one request at
a time) from all users of that stateless session bean. You don't
"own" a stateless session bean.

> OR i need to mySessionRemote = null to releases the session on
> server.... ?

All the client holds is a reference to a "service" that doesn't know
you or remember you or care about you (nothing personal). It doesn't
matter if you nullify your remote reference or not. You can hold onto
the reference as long as you like and the server doesn't act any
differently.
>
> the session is "only for me" in instant of call .ping() and end
> solicitation...

Well, sorta. Some "arbitrary" stateless session bean instance is
allocated to you when your request arrives and is dedicated to
servicing that request. After it's done with the request, it might be
destroyed or used to service some other request. You have no
visibility into this behavior.
>
> or is "locked to me" while mySessionRemote not set to nulll ?

no.

Hope this helps,

Craig

>
>
>
> Tnks in advance.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell_at_sun.com
P.S. A good JDO? O, Gasp!