Hi Gavin,

I think, the results u r getting are purely coincidental.

You can never guanrantee the state of a stateless bean. Each call to a SSB
can be executed on a different  instance. If u set a value in the SSB, u can
never ensure that next time it will be this set value that will be used.


-----Original Message-----
From: Gavin Selvaratnam [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 02, 2001 10:47 AM
To: [EMAIL PROTECTED]
Subject: State In A Stateless Session Bean


Hi,
    I have a problem of understanding what is meant by "Stateless Session
Bean do not hold state". In my sample application I have a
     - stateless session bean called SSB
     - which has a instance variable called x
     - The SSB has a method called addOneToX() which increase x by one.
     - I have a servlet called conectToSSB which looks up the SSB and calls
the addOneToX() method.
     - I access the conectToSSB servlet from 2 different machines.

     My problem is when I query the value of x for the first client it is 1
but for the second client it is 2. Which means the SSB has been holding
state. Which is wrong because when the second client accesses the SSB it
should get a fresh SSB.   Am I doing something wrong ?

Thanks,
Gavin
(Analyst Programmer JKCS, Sri Lanka)

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".
This e-mail and any files transmitted with it are for the sole use of the intended 
recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply e-mail and 
destroy all copies of the original message. Any unauthorised review, use, disclosure, 
dissemination, forwarding, printing or copying of this email or any action taken in 
reliance on this e-mail is strictly prohibited and may be unlawful.
Visit us at http://www.cognizant.com

Reply via email to