Hi Alex,
My understanding is that a request gets a checked out bean instance for the
duration of the method call. No other call will get this bean instance until
it is returned to the pool, after the method call completes.
If you have a bean class field like private final AtomicInteger then you can
increment it in every method call on that bean. You will see that each bean
will keep it's own call count. Putting it back into the pool will not reset
the variable.
The chance that another call will get the same bean is never guaranteed.
It's maybe interesting to see in a loop how often you actually get the same
instance.
So a stateless bean can actually have state, but it 'may' get discarded - At
least when the instance is discarded. You may also get a completely new
instance on the next call if the pool is starved etc.
Anyway, putting anything into a class variable in a stateless is probably
not a good idea as the next caller may have access to it. If you do, clean
it up before returning from the call.
Romain, without looking, do we pop from the head and put back to the tail?
Andy.
-----
--
Andy Gumbrecht
http://www.tomitribe.com
[email protected]
https://twitter.com/AndyGeeDe
TomEE treibt Tomitribe ! | http://tomee.apache.org
--
View this message in context:
http://tomee-openejb.979440.n4.nabble.com/Stateless-EJB-and-attributes-tp4670426p4670477.html
Sent from the TomEE Users mailing list archive at Nabble.com.