• Post Reply Bookmark Topic Watch Topic
  • New Topic

Ejb Newbie - Help

 
Sanjeev Verma
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there
I am a newbie to EJB, Refering the O'Rielly book. I have a doubt in Instance pooling and Concurrency. If you have the book, read thru' page no 50-51 in which the author talks about instance pooling of Entity beans. The basic idea is the same as database connection pooling.
Now go to page no. 58 in which the author talks about entity beans being thread safe. he says that although the ejb object is accessed by multiple clients at the same time, it forwards only one requested method invocation at a time to the bean instance it wraps.
i am finding both these concepts in conflict with each other. if you have a connection pool, it means that more than one instance of the bean can be in use concurrently, which in turn takes the concept of being thread safe for a ride. i know that i might not be very clear in my framing, but please help me none the less
regards
sanjeev
 
Nirav Parghi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

the ejbCreate() method picks an instance from the pool,
and binds it to a specific EJBHome object. all the method
calls to that EJBObject will be made thread safe. The key here is that only one instance bound to one EJBObect is servicing the
method calls. All the other instances inthe pool are inactive.
 
Nirav Parghi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

the ejbCreate() method picks an instance from the pool,
and binds it to a specific EJBHome object. all the method
calls to that EJBObject will be made thread safe. The key here is that only one instance bound to one EJBObect is servicing the
method calls. All the other instances inthe pool are inactive.
 
Nirav Parghi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

the ejbCreate() method picks an instance from the pool,
and binds it to a specific EJBHome object. all the method
calls to that EJBObject will be made thread safe. The key here is that only one instance bound to one EJBObect is servicing the
method calls. All the other instances inthe pool are inactive.
 
Sanjeev Verma
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nirav
Definately i am the one who is missing something, but if what you say is true (the book also says so), then why do u need a instance pool in the first place. After all, only one instance is serving the EJBObject while others are inactive??
Please help.
Sanjeev
 
Sagar Sharma
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take an example where there are 5 simultaneous calls to the Entity Bean for inserting a new record (ejbcreate()) and 5 calls to find something (say by primary key).
In such a case the dtatbase insertions takes place one after one since the integrity of the data being entered is to be maintained . While all the 5 find functions could operate simultaneously to give the results.
please clarify if I am wrong?
please mail me if i am wrong:
sagarsagar@go.com

thanks

sagar
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!