Cheng,
Thanks for your reply.
> Most injectable resources are actually immutable such
> as javax.sql.DataSource, or javax.jms.Destination,
> etc. So they should already be thread safe.
Ummm. Isn't javax.sql.DataSource a Java *interface*? Are you
saying that "instances" of its implementation class guaranteed
to be immutable? Where is it specified?
It is correct that if an interface does not have a mutator, you are fine with
its state, but that's not true with any interface. Thus, I guess my question
is with any injectable resource.
> In EJB (bean class or interceptors), component
> instances are not shared between threads. Web
> components may be shared by multiple threads
Aren't web components always shared by multiple threads?
> and so
> more care is needed with field/setter injections for
> non-thread-safe resources. But I doubt if using
> volatile would solve it. Just my 2 cents.
I think I was more interested in the injection process itself.
Is it guaranteed to be thread-safe or should making a field volatile help?
Thanks,
Kedar
>
> -cheng
[Message sent by forum member 'km' (km)]
http://forums.java.net/jive/thread.jspa?messageID=245830