LaBanca, Rick wrote:
Say I had a stateless session bean, that had an instance variable foo, and
in ejbCreate, it set foo (always to a singleton object), and one method to
use foo in some way.

Since ejbcreate will be called first anyway, is there any internal jboss
voodoo that could give me a surprise? Techically it's wrong because I have a member variable between calls... A
state, right?
Not really - 'stateless' refers to state dependent on a particular client. Having member variables is allowed (IIRC).

The thing to look out for is the possibility of one thread leaving confidential information in a member variable. In your case with the singleton, the singleton needs to be thread safe of course.

Or is it acceptable to make instance variables used across
invocations if I make sure they are initialized in ejbcreate?

I ask more than for curiosity, we have some jvm problems and while grasping
at straws I noticed some code doing this. I will make it right, but
wondering what right is.

Rick


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to