Actually, when a client invokes a method on a stateless session object, the container takes one session bean out of the pool and invokes the method on it. When the call returns, the container might put the instance back in the pool or use it for servicing other incoming calls. The bottom line is that at any time, only one client is executing a method of given session bean instance. So, yes, multiple clients may have a reference to "the same" stateless session bean, but due to the nature of stateless session bean, you have no idea how the container decides to manage those reference, and thus, you have no idea whether the references the client has all point to the same stateless session bean. Actually, you don't even have to care about the instance that is executing your calls since the beans are stateless, and thus, they all do the same job... Does this make sense to you?
Stateless session beans may declare instance variables, of course. The only requirement is that those variables should not be used to store client-specific data since they are supposed to be stateless... Examples of instance variables are database connections, etc... [ June 30, 2004: Message edited by: Valentin Crettaz ]
My Linked In
posted 16 years ago
thanks Valentin and Shankar its clear now.
Right! We're on it! Let's get to work tiny ad!
Devious Experiments for a Truly Passive Greenhouse!