• Post Reply Bookmark Topic Watch Topic
  • New Topic

Each Entity Bean may however be shared by multiple EJB Clients.

 
thomas davis
Ranch Hand
Posts: 207
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Each Entity Bean may however be shared by multiple EJB Clients.
How this concept being implemented in EJB ?
What is instance pooling in EJB ? How does server help to do it?
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Each Entity Bean may however be shared by multiple EJB Clients.
How this concept being implemented in EJB ?

Each client performs its operations in a transaction, which isolates the clients' operations from each other.
What is instance pooling in EJB ? How does server help to do it?

The lifecycle of EJBs described in the EJB 2.0 specification explains the pooling pretty well. Here's the short version, however:
For stateless session beans, the EJB Container can keep a pool of "free" instances of the EJBObject/implementation class. When an invocation is received for that particular session bean, one of the free instances is picked from the pool, the method invocation is delegated to it, and the bean is returned into the free pool.
Entity beans are pooled a bit differently. The container keeps a pool of free instances who don't have any identity associated at that time. Once the client requests a reference to a particular entity (identified with a primary key), the container picks one instance from the pool, assigns it the identity (primary key), loads the data into the instance, and lets it handle the client's requests. When the container figures out that the bean is no longer being used, it returns it removes the identity and puts it back into the free pool.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!