Its a shame the ejb spec doesn't specify an issue as important as this.
Until it does, you will see different vendors' interpretation of this
non-spec.  My philosophy, as a bean developer, is to make blanket-statements
that caters to the lowest-common denominator, hence making my application
portable.  Once the Sun steps up with this specification, then we are all
the better for it!

In our original architecture we had our servlet retain reference to a
Stateless Session Bean EJBObject.  I later vetoed this design and instead
had the servlet retain the EJBHome reference and call EJBHome.create() for
each service() call.  My reason for this is in case we later decide to
switch to Stateful Session Bean, we will not have to change our client
server design.  Furthermore, I benchmarked EJBHome.create() under Weblogic
5.1 and found the server resourceful enough not to incur too great an
overhead in comparison to reusing the EJBObject;  hence we all agreed and
stuck with my design.

Gene Chuang
Kiko.com


-----Original Message-----
From: Jonathan K. Weedon [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 26, 2001 1:57 PM
To: Gene Chuang
Cc: [EMAIL PROTECTED]
Subject: Re: Thread-safety


Gene,

I guess it depends on the definition of a "stateful bean".

Per the EJB spec:

* Stateful session beans are not allowed to be accessed from multiple
threads.
* Stateless session beans are allowed to be accessed from multiple threads.
* Entity beans (which I would consider stateful) are allowed to be accessed
from multiple threads.  To do this correctly requires optimistic concurrency
in
the persistence manager.

Whether the EJBObjects used to access these objects are thread safe is up
to the particular vendor.  In Borland AppServer (which is built on
VisiBroker)
our stubs are always thread safe and multiplexed.  Therefore, the request
always
gets to the EJB Container intact, even from multiple threads. This is not
true
of some other products, where even the stub itself is not thread safe.  The
EJB
container then makes a determination whether access is allowed; sometimes it
is, and sometimes it isn't, as per the spec. above.

I certainly would not make the blanket statement that EJBObjects are not
thread
safe, but maybe that is just a difference in communication style.

-jkw

Gene Chuang wrote:

> EJBObjects are threadsafe in Borland, even for stateful beans???
>
> I know EJBObjects are ALSO threadsafe in Weblogic, but it doesn't make
sense
> for 2 threads to hit an stateful EJBObject under ANY container, does it?
> Hence I made the blanket statement that all EJBObjects are not
threadsafe...
> I think its just safer for bean developers that way!
>
> Gene Chuang
> Kiko.com
>
> -----Original Message-----
> From: Jonathan K. Weedon [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, June 26, 2001 1:34 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Thread-safety
>
> Gene,
>
> I am guessing you meant to say:
>
>     In WebLogic, EJBHomes are threadsafe, EJBObjects are not.
>
> A different answer is:
>
>     In Borland AppServer, EJBHomes are threadsafe, EJBObjects are too.
>
> Unfortunately, I don't believe the EJB spec itself discusses this issue.
>
> -jkw
>
> Gene Chuang wrote:
>
> > EJBHomes are threadsafe, EJBObjects are not.
> >
> > Gene Chuang
> > Kiko.com
> >
> > -----Original Message-----
> > From: Ian McCallion [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, June 25, 2001 5:57 AM
> > To: [EMAIL PROTECTED]
> > Subject: Thread-safety
> >
> > Do the threads of a multithreaded client need synchronise their use of
> home
> > objects and ejbObjects?
> >
> > cheers... Ian
> >
> > ========================================
> > Ian McCallion
> > Alexis Systems Limited
> > Romsey, UK
> > Tel: +44 1794 514883
> > Fax: +44 1794 501692
> > ========================================
> >
> >
>
===========================================================================
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> > of the message "signoff EJB-INTEREST".  For general help, send email to
> > [EMAIL PROTECTED] and include in the body of the message "help".
> >
> >
>
===========================================================================
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> > of the message "signoff EJB-INTEREST".  For general help, send email to
> > [EMAIL PROTECTED] and include in the body of the message "help".
>
>
===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff EJB-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>
>
===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff EJB-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".

--
                  Jonathan K. Weedon: Architect
                  VisiBroker, Borland AppServer

Register now for the 12th Annual Borland Conference: July 21-25 in
Long Beach, California.  BorCon is the best place to learn about award
winning technologies for implementing e-business.  Register today!
                 http://www.borland.com/conf2001/

This e-mail, and any attachments thereto, is intended only for use by
the addressee(s) named herein and may contain legally privileged
and/or confidential information.  If you are not the intended
recipient of this e-mail, you are hereby notified that any
dissemination, distribution or copying of this e-mail, and any
attachments thereto, is strictly prohibited.  If you have received
this e-mail in error, please immediately and permanently delete the
original and any copy of any e-mail and any printout thereof.

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to