Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can stateful session bean be pooled?

 
Denis Wang
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are conflicting answers to this question:
1) SFSB is pooled the similar way as an entity bean in the sense that activation/passivation are used.
2) according to the specification, there is no SFSB pooling enforced. container vendor might choose to achieve the <<EFFECT of>> pooling.
any comments?
Thanks.
Denis
 
Luciano Queiroz
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stateful session beans may be pooled by the container to improve performance and save resources.
In this case the container will invoke the methods ejbPassivate/ejbActivate.
The same does not apply to stateless session beans.
 
Martin Sergeant
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I too am a bit confused about pooling in stateful session beans.
According to Mastering EJB (Ed Roman), when home.create() is called a new instance of the bean is created and when remove() is called (on either remote or home) the instance is destroyed - no pooling employed here. However when the number of beans reaches capacity beans are passivated and activated so that only a certain number of beans exist at one time -pooling. I don't understand why data can't be associated with an existing bean (in a similar manner to activation) when a bean is created and dissociated from the bean without destroying it when remove() is called (similar to passivation, but without the need to save any data) ?
 
Bharat Ruparel
Ranch Hand
Posts: 493
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is my 2 cents: Stateful session beans do not use pooling as in stateless session beans or the entity beans.
They do however specify a "Cache" size, i.e. how many max. beans can be held in the container's memory before the time-out limit is reached. In the meantime, if there are more clients than the max-beans-in-cache limit, then the container will passivate beans using some kind of algorithm (e.g. LRU - Least Recently Used) and make room for additional clients. Therefore, there is no "pooling" involved in the classical sense, however there is definitely "caching" of the beans in the memory. Unfortunately, the writers loosely mix pooling and caching sometimes causing unnecessary confusion.
Hope this helps.
Regards.
Bharat
 
Alessandro Martins
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I'm concerned, there's a good difference between pooling and passivation/activation mechanisms. The first one exists to let the application server instantiate objects ahead of the time of their use, so it doesn't have to allocate resources in order to produce these objects when its under siege, responding to a lot of clients. This is more applicable to SLSB's, once they are the "use it once, throw it away" kind of business object, so we can grab them back from the "garbage can" and offer its services to a new client.
Activation/passivation have more to do with managing the resources of an already-working application. As real machines cannot have infinite memory and CPU time, there must be some way to put the session-aware components that are long enough using resources "to sleep" and give the chance for newcoming requests, much like the idea of preemption in OS's. So the state of these objects are kept in its serilizaed form in disk and retrieved back in memory when its time comes.
It's a subtle, but complete difference...
Thanx,
Alessandro Martins
No certs, only battle scars :-)
 
Siyaram Singh
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am 100 % aggree with Alessandro Martins. Activation/passivation and Pooling both are diferent. ...............
Bye,
SS
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic