commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henri Yandell (JIRA)" <j...@apache.org>
Subject [jira] Updated: (POOL-4) GenericObjectPool: Negative _maxActive doesn't allow growth
Date Fri, 14 Jul 2006 04:38:41 GMT
     [ 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


Mime
View raw message