Hello,
First message on Java Ranch
I'm currently working on SLSB Stateless Session Bean, and more specifically doing some tests on an instance variable of the SL EJB.
I know, instance variables for SLSB are not supposed to be used - only maybe to keep track of an internal state for the EJB - and should not be accessed by the Client. I'm just doing this test to fully understand the mecanics of the EJB container and the pooling.
Ok so I create a simple EJB with a simple counter as an instance variable, and a log to keep track of the value:
The remote interface looks like this:
And a client that calls the retrieveSomeString method:
I'm using Glassfish, for testing purposes and for understanding how this case should work, I set:
Initial and Minimum Pool Size: 0
Maximum Pool Size: 0
After three runs of the client, I get the following log on the server side:
INFO: [SLSB log] : privateState value is 1
INFO: [SLSB log] : privateState value is 2
INFO: [SLSB log] : privateState value is 3
which is weird because this means that the same instance of the EJB is always running.
Since the pool is set to 0, souldn't the SLSB be created when needed then directly destroyed?
Thanks