You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Henri Yandell (JIRA)" <ji...@apache.org> on 2006/07/14 06:38:41 UTC

[jira] Updated: (POOL-4) GenericObjectPool: Negative _maxActive doesn't allow growth

     [ http://issues.apache.org/jira/browse/POOL-4?page=all ]

Henri Yandell updated POOL-4:
-----------------------------

    Bugzilla Id:   (was: 13649)
    Fix Version: 1.1

> GenericObjectPool: Negative _maxActive doesn't allow growth
> -----------------------------------------------------------
>
>          Key: POOL-4
>          URL: http://issues.apache.org/jira/browse/POOL-4
>      Project: Commons Pool
>         Type: Bug

>     Versions: 1.0.1
>  Environment: Operating System: other
> Platform: Other
>     Reporter: John Rayburn
>      Fix For: 1.1

>
> setMaxActive documents that:
> The cap on the total number of active instances from my pool.
> Use a negative value for an infinite number of instances.
> However, the code (see below) when _maxActive is negative, acts as if the pool 
> is empty, not that infinite resources should be allowed:
>                 if(_maxActive > 0 && _numActive < _maxActive) {
>                     Object obj = _factory.makeObject();
>                     pair = new ObjectTimestampPair(obj);
>                 } else {
>                     // the pool is exhausted
>                     switch(_whenExhaustedAction) {
>                         case WHEN_EXHAUSTED_GROW:
>                             Object obj = _factory.makeObject();
>                             pair = new ObjectTimestampPair(obj);
>                             break;
>                         case WHEN_EXHAUSTED_FAIL:
>                             throw new NoSuchElementException();
>                         case WHEN_EXHAUSTED_BLOCK:
>                             try {
>                                 if(_maxWait <= 0) {
>                                     wait();
>                                 } else {
>                                     wait(_maxWait);
>                                 }
>                             } catch(InterruptedException e) {
>                                 // ignored
>                             }
>                             if(_maxWait > 0 && ((System.currentTimeMillis() - 
> starttime) >= _maxWait)) {
>                                 throw new NoSuchElementException("Timeout 
> waiting for idle object");
>                             } else {
>                                 continue; // keep looping
>                             }
>                         default:
>                             throw new IllegalArgumentException
> ("whenExhaustedAction " + _whenExhaustedAction + " not recognized.");
>                     }
>                 }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org