I often use SLSB fields to cache configuration data and other stable data.
My motivation for doing so, is that I get "pooled" caching without having to
deal with thread synchronization. In most cases it has not been a problem
that there are many instances in the cache, since they are still a very
limited number compared to the number of requests on these instances.

I was hit by Visual Age 3.5(.0), which didn't (in the test environment) pool
SLSB instances. A new instance was created on each request. Shortly after,
there as a discussion on this list, where (if I remember) Dave Ireland
commented that the spec requires that the container pools SLSBs in the
method-ready-pool (implicitly saying that the VAJ test environment was not
spec-complient).

Comments? Am I portable when I depend on the method-ready-pool?

Thank.

/Johan

-----Original Message-----
From: A mailing list for Enterprise JavaBeans development
[mailto:[EMAIL PROTECTED]]On Behalf Of Aggrawal, Shelly (Cognizant)
Sent: den 2 november 2001 06:49
To: [EMAIL PROTECTED]
Subject: Re: State In A Stateless Session Bean

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

===========================================================================
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".

Reply via email to