Yes I don't see it could be a really good practice but in document it was said as a solution to not create private methods with a lot of method parameters because they could be set as attributes. Because it sounded a bit strange I asked to know it if it is portable or not.
2014-07-16 12:12 GMT+02:00 Romain Manni-Bucau <[email protected]>: > I don't recall exactly our default but it is configurable/pluggable > > > Romain Manni-Bucau > Twitter: @rmannibucau > Blog: http://rmannibucau.wordpress.com/ > LinkedIn: http://fr.linkedin.com/in/rmannibucau > Github: https://github.com/rmannibucau > > > 2014-07-16 12:09 GMT+02:00 agumbrecht <[email protected]>: > > 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. > -- +----------------------------------------------------------+ Alex Soto Bueno - Computer Engineer www.lordofthejars.com +----------------------------------------------------------+
