dan benanav wrote:
>
> Here is something that I wonder about.  There are session beans as referred to below 
>and
> there are also ejb session beans.  Ejb session beans should only be accessed by one
> client at a time (which I assume means one thread).  Often session beans call on ejb
> session beans.  But since session beans might be call by more then one thread at a 
>time
> you shouldn't do that.
>
> So how can ejb session beans be used from a session bean?

I haven't studied interfacing to EJB in detail (yet), but I assume you can
use "synchronized" around the block of code that calls the EJB. But I also have
a feeling that EJB already takes care of serializing calls to session EJBs,
so it may not be necessary. As far as I know, a "session" in EJB terms is the
same as for servlets (a series of requests from the same client), so conceptually
it shouldn't be a problem.

But as I said, I haven't looked at this enough yet. If I'm wrong, I hope someone
corrects me.

Hans

> Hans Bergsten wrote:
>
> > Jari Worsley wrote:
> > >
> > > Session scope beans are available to a user and their browser session (I'm 99% 
>sure
> > > that one session corresponds to connection from one browser program).
> > > So if a user has two browser windows open accessing pages on your site, then they
> > > can potentially create simultaneous requests that access the same bean in session
> > > scope. So session beans need to be thread safe.
> >
> > Actually, one session corresponds to a set of requests from the same client within 
>a
> > certain period of time (the connection between the client and server may be
> > closed and reopened, but the session remains).
> >
> > But yes, a user with multiple browser windows can cause multiple requests
> > within the same session. Other cases are when you use frames where the
> > content of each frame is from a JSP page; the browser will request all frames
> > at roughly the same time so you have multiple requests in the same session.
> > And another is a user that keeps hitting the Submit button before the response
> > is delivered; every time a new request is made but the previous request may
> > still be executing.
> >
> > Hans

--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to