commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 13649] New: - GenericObjectPool: Negative _maxActive doesn't allow growth
Date Tue, 15 Oct 2002 14:51:25 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13649>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13649

GenericObjectPool: Negative _maxActive doesn't allow growth

           Summary: GenericObjectPool: Negative _maxActive doesn't allow
                    growth
           Product: Commons
           Version: 1.0.1 Final
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Pool
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: johnrayburn@hotmail.com


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.");
                    }
                }

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


Mime
View raw message