Author: markt
Date: Sun May 17 21:32:59 2009
New Revision: 775762
URL: http://svn.apache.org/viewvc?rev=775762&view=rev
Log:
Code clean-up
Modified:
commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
Modified:
commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
URL:
http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java?rev=775762&r1=775761&r2=775762&view=diff
==============================================================================
---
commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
(original)
+++
commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
Sun May 17 21:32:59 2009
@@ -1033,9 +1033,10 @@
}
private synchronized void allocate() {
+ if (isClosed()) return;
+
// First use any objects in the pool to clear the queue
for (;;) {
- if (isClosed()) return;
if (!_pool.isEmpty() && !_allocationQueue.isEmpty()) {
Latch latch = (Latch) _allocationQueue.removeFirst();
latch._pair = (ObjectTimestampPair) _pool.removeFirst();
@@ -1047,9 +1048,9 @@
break;
}
}
+
// Second utilise any spare capacity to create new objects
for(;;) {
- if (isClosed()) return;
if((!_allocationQueue.isEmpty()) && (_maxActive < 0 || (_numActive
+ _numInternalProcessing) < _maxActive)) {
Latch latch = (Latch) _allocationQueue.removeFirst();
latch._mayCreate = true;