Thanks Tibo, but through no fault of yours I'm still a little fuzzy.
Let me ask this another way. If a client looks up an EJBHome from JNDI,
can that client give that home to multiple concurrent threads?
EJBFooHome home = jndiLookup("EJBFooHome");
for( int i = 0; i < 100; i++ )
{
new Thread() {
public void run()
{
Foo f = home.create( i );
}
}.start();
}
In the above case, would the ejb container, which I assume is intercepting the create
calls against
home, taking care of synchronization?
What I'm driving at here is this. If the above scenario won't work, then I can't cache
EJBHome
object and dole it out to multiple concurrent threads. Right?
Thanks. (Sorry, I keep waiting for the light to go on)
Thibault Cuvillier wrote:
> Rich,
>
> I did not found anywhere in the J2EE/RMI spec that a proxy has to be
> multi-thread safe. I speak about the PROXY, not the remote object (which is
> multi-thread safe according to the J2EE spec). This point was confirmed by
> Chris Raber who is a trustable guy !
>
> So, if you share a proxy between multiple threads in a client, you must
> synchronize the proxy by wraping it in a synchronized smart proxy.
>
> The Synchronized smart proxy and the linked proxy can be stored in a cache
> to avoid to many JNDI calls.
>
> You can face this situation if a servlet/JSP cache the proxy to the Home
> objects, because each user request will start a new thread. Most of the
> systems do not synchronize the cached proxies on a Home, and it looks to
> work anyway.....
>
> If more than one client get a proxy to the remote object, there is no
> problem, because each client will use it's own proxy instance and server
> connection.
>
> This is what I understood from this discussion.
>
> Tibo.
>
> > -----Original Message-----
> > From: Rich Johns [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, August 14, 2000 3:17 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: Is a Proxy is thread-safe? - Summary
> >
> >
> > Hi Tibo,
> >
> > What is the conclusion of this question? Is it really true,
> > that if you
> > cache EJBHome objects, you must synchronize them? I thought
> > the ejb container handled that?
> >
> > If multiple clients grab the same EJBHome object from JNDI and
> > all use it simulataneously, the container must be at work managing
> > thread saftey. Or, is it the case that each client gets its own stub,
> > which is what allows the thread saftey.
> >
> > If you have an understanding of this, could you please explain this.
> > I've just completed a design where I was planning to cache EJBHomes
> > and now I'm not sure.
> >
> > thanks very much.
> >
>
> [cut to save bandwidth !]
>
> ===========================================================================
> 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".