Hi all,
I am new to EJB and I am now using JBOSS to do some development.
I have written a stateless session bean and I would like to know if the
bean is thread safe. Since, my session bean has a static object, I
would like to have all my bean instances sharing a common object. My
guess is each session bean is not thread safe. So, can anyone give me
some suggestion to get around this problem.
The idea is I would like to have all instances of my session bean to
share a common resource. The common resource may be a huge byteBuffer
(I don't want all my bean instance has its own copy for space reason)
or it has a socket to communicate with another process outside of the
VM.
I really want to use the best option available to tackle this problem,
then I will have a better understanding how EJB works.
Thanks!!!
EJB Spec is against multi threading and non-final static variables
Check this url for a discussion similar to your problem
http://www.theserverside.com/discussions/thread.tss?thread_id=765
Thanks