This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Pooling in java or EJB ?  RSS feed

 
scott miles
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
we have pooling concept in stateless EJB. What is the advantage of using pooling? My understanding is that it will just save the time in object creation. Is this right?If yes is there a significant difference in performance in creating the object or getting it from the existing pool? Does the pooling serve any other purpose than this?
 
lokesh sree
Ranch Hand
Posts: 100
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi scott,

Except for saving the time in object creation that you have already mentioned, I do not think there is any other reason for the pooling of stateless beans maintained by the container. And there definitely would be lot of performance difference between creating a new SLSB every time and getting one from the pool.
For a plain java object, there might not be a lot of difference.
However, we need to note that statless beans are a lot different from plain objects. Each SLSB object should have all its dependencies(resources, other beans etc.) injected at its creation time. Also, there would lot of declarative information(transaction specific, authentication details etc.) that should be parsed for that bean and be known to the container during the object creation. I believe all these should make a bean object creation very expensive and hence the JEE has introduced the concept of pooling for stateless beans.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!