Upon startup, WebLogic Server automatically creates and populates the free pool with the quantity of instances you specify in the bean's initial-beans-in-free-pool
deployment element in the weblogic-ejb-jar.xml file. By default, initial-beans-in-free-pool is set to 0.If you configure a pool, WebLogic Server will service method calls with an EJB instance from the free pool, if one is available. The EJB remains active for the duration of the client's method call. After the method completes, the EJB instance is returned to the free pool. Because WebLogic Server unbinds stateless session beans from clients after each method call, the actual bean class instance that a client uses may be different from invocation to invocation.
If all instances of an EJB class are active and max-beans-in-free-pool has been reached, new clients requesting the EJB class will be blocked until an active EJB completes a method call. If the transaction times out (or, for non-transactional calls, if five minutes elapse), WebLogic Server throws a
RemoteException for a remote client or an EJBException for a local client. Note: The maximum size of the free pool is limited by the value of the max-beans-in-free-pool element, available memory, or the number of execute threads.
When an application requests a bean instance from the free pool, there are three possible outcomes:
- An instance is available in the pool. WebLogic Server makes that instance available and your application proceeds with processing.
- No instance is available in the pool, but the number of instances in use is less then
max-beans-in-free-pool. WebLogic Server allocates a new bean instance and gives it to you. - No instances are available in the pool and the number of instances in use is already
max-beans-in-free-pool.You application must wait until either your transaction times out or a bean instance that already exists in the pool becomes available.