It's perfectly ok for an SLSB to have member variables. A common example is a reference to some entity bean's home interface.

You get into trouble when the SLSB's public methods are allowed to change the state of the member variable. At that point, all bets are off since a client never knows exactly which SLSB is going to receive the function call. A client can never make assumptions about the state of an SLSB prior to invoking it. It must pass any required state as parameters to each function.

-- Jim

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? 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




-------------------------------------------------------
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

Reply via email to