You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "Manu T George (JIRA)" <ji...@apache.org> on 2008/03/31 13:00:24 UTC

[jira] Commented: (OPENEJB-786) Stateless Container StrictPooling option ignored

    [ https://issues.apache.org/jira/browse/OPENEJB-786?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12583632#action_12583632 ] 

Manu T George commented on OPENEJB-786:
---------------------------------------

Hi,
   I believe that the problem is in the method poolInstance of the StatelessInstanceManager.
  Currently we do
        if (strictPooling) {
                pool.push(bean);
                poolQueue.notifyWaitingThreads();
         }
We do not do a check here and since none of the methods are synchronized in the StatelessInstanceManager this will not work. A better thing to do is to check

        if (strictPooling) {
        	if(pool.size() < poolLimit){
                pool.push(bean);
                poolQueue.notifyWaitingThreads();
        	} else {
        		freeInstance(callContext, (Instance)bean);
        	}

However I believe this also can fail in very rare cases. i.e when the thread executing this method is paused by the scheduler after the pool size check and another thread pushes a bean inside then the size will again exceed the poolLimit by 1. Now to prevent this we need to synchronize the size checks and the push/pop operations together in a block.

On the other hand if its ok for the pool size to slightly exceed the set size then the synchronisation is not required. The synchronisation will reduce performance while not doing will result in pool size exceeding the limit by 1.
 
Comments/Suggestions/Corrections Please :). 

> Stateless Container StrictPooling option ignored
> ------------------------------------------------
>
>                 Key: OPENEJB-786
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-786
>             Project: OpenEJB
>          Issue Type: Bug
>            Reporter: David Blevins
>             Fix For: 3.0.x
>
>
> Setting PoolSize to 100 and StrictPooling to true should do exactly what you want (i.e. block requests in a wait state till one of the 100 instances are returned to the pool).  If this isn't working it's definitely a bug.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.