Ejb pooling

Discussions

EJB programming & troubleshooting: Ejb pooling

  1. Ejb pooling (4 messages)

    HI,
       What are the beans (session, entity)can be pooled?How the container takes care of pooling of the Beans

    Regards
    Samy

    Threaded Messages (4)

  2. Ejb pooling[ Go to top ]

    StatelessSession and EntityBeans can be pooled not StatefullSessionBeans.

    EJB Container creates several EJBInstances of a bean class and then holds onto them until they are needed. When client Requests a business method,bean instances from the instancepool are assigned to the EJBObjects associated with the client When the EJBObject is not needed anymore,it is returned to the InstancePool.Every Instance in a pool is equivalent.Instances are selected arbitrarily from instance pool and assigned to the EJBObjects as needed.

    InstancePooling mechanism is not applied to StatefullSessionBeans.Because,StatefulSession beans are bound to one, and only one, bean instance for the entire life of the bean. This is how it is able to maintain state. The container will take care of passivating and activating the bean.

    Thanks & Regards.
    Vijaya.
  3. Ejb pooling[ Go to top ]

    For the Stateful session beans, since it is not pooled, it doesn't mean that it can serve only clients equal to the maximum number of instances defined for that bean type. The container utilizes the clients "think" time. Let say there are 10 clients attached to the server and the maximum beans instances allowed are 10 and there is one more client is trying to establish a connection with the bean (client 11). Then the container will pick some instance which are not involed in transaction currently, to passivate and use that instance for the new client. If the number of clients are lot more than number of bean instances, then the container will do passivation and activation very often, thus the performance will be degraded.
  4. Ejb pooling[ Go to top ]

    If say the 11th User has got the reference of the 2nd user, who was idle then all the resources assciated with it will be lost? I mean if the user 2 again comes then from where will he get the information associated with him before passivating. Does the container stores the information in buffer?

    Regards
    Suhas S
  5. Ejb pooling[ Go to top ]

    If say the 11th User has got the reference of the 2nd user, who was idle then all the resources assciated with it will be lost? I mean if the user 2 again comes then from where will he get the information associated with him before passivating. Does the container stores the information in buffer?RegardsSuhas S
    The container will store the 2nd user's states(Serializable attributes) into a secondary store before it assigns the 2nd user's bean instance to 11th user. When the 2nd user invokes a business logic(Note: the connection between the client and EJBObject is not broken, it is alive), the container passivates some other clients bean, let say 3rd user and activates our 2nd user states into the 3rd user bean instance.