HI Every body, In EJB how to create the instances. How many instances will create for application. Suppose if 10 users will access any bean it will create 10 instances or one instance(I think one instance means it will come single ton. EJB not supporting single ton extensively) for any bean like Session or Entity beans.
HI Every body, In EJB how to create the instances. How many instances will create for application. Suppose if 10 users will access any bean it will create 10 instances or one instance
Usually developers do not control the way bean instances are created into the pool. All they can do is to define the initial number and the maximum number of bean instances in the pool. The container will create more and more instances as needed up to the specified maximum value; all incoming client requests will block after that waiting for instances to become available. If the transaction timeout is exceeded the container will throw an exception.
I think one instance means it will come single ton. EJB not supporting single ton extensively)
You right singleton are not supported. However there is a work around: define the initial number of instances = max number of instances = 1. This way you�ll have exactly one bean instance (kind of singleton). However this paradigm will brake in a clustered environment. Regards.
Hi Valentin Tanase , first Thank you for your valid information.
I have one doubt again,Is it possible to declare instances in server level? if not, who will declare , it is based on server vendor or ? do you have any idea abt what is the min and max instances declaration for any server or (how many for weblogic,Jboss).
If you don�t specify any values for the initial-beans-in-free-pool or max-beans-in-free-pool configuration parameters, then the container will use some default values. WebLogic for example will default the first parameter to 0 and the second to 1000 for entity ejbs. The rule is little bit more complicated for SLSB. The first parameter still defaults to 0, but the second one depends upon the available memory and the number of execute threads. Regards.
As far i know it really costly and troubling giving if u use Singleton Dsgn Pattern....it is almost like creating a servlet which extends Single thread Model...
coming to Num of instsnces...
in Weblogic we have option for creating instances for both Max ...when used with struts frameworm u make use of plugin so that as soon as ur app is UP it will create instance it sis some thing like u r creating ur own Pool manager..
we have a provision for max instances... so if instances exceeds web app wich will poll the instances (actiovation / p assivvation)....