|
28 | 28 | import java.util.NoSuchElementException; |
29 | 29 | import java.util.Objects; |
30 | 30 | import java.util.TreeMap; |
| 31 | +import java.util.concurrent.BlockingDeque; |
31 | 32 | import java.util.concurrent.ConcurrentHashMap; |
32 | 33 | import java.util.concurrent.atomic.AtomicBoolean; |
33 | 34 | import java.util.concurrent.atomic.AtomicInteger; |
@@ -310,7 +311,7 @@ public GenericKeyedObjectPool(final KeyedPooledObjectFactory<K, T> factory, |
310 | 311 | private void addIdleObject(final K key, final PooledObject<T> p) throws Exception { |
311 | 312 | if (PooledObject.nonNull(p)) { |
312 | 313 | factory.passivateObject(key, p); |
313 | | - final LinkedBlockingDeque<PooledObject<T>> idleObjects = poolMap.get(key).getIdleObjects(); |
| 314 | + final BlockingDeque<PooledObject<T>> idleObjects = poolMap.get(key).getIdleObjects(); |
314 | 315 | if (getLifo()) { |
315 | 316 | idleObjects.addFirst(p); |
316 | 317 | } else { |
@@ -697,7 +698,7 @@ public void clear(final K key, final boolean reuseCapacity) { |
697 | 698 | final ObjectDeque<T> objectDeque = register(key); |
698 | 699 | int freedCapacity = 0; |
699 | 700 | try { |
700 | | - final LinkedBlockingDeque<PooledObject<T>> idleObjects = objectDeque.getIdleObjects(); |
| 701 | + final BlockingDeque<PooledObject<T>> idleObjects = objectDeque.getIdleObjects(); |
701 | 702 | PooledObject<T> p = idleObjects.poll(); |
702 | 703 | while (p != null) { |
703 | 704 | try { |
@@ -1629,7 +1630,7 @@ public void returnObject(final K key, final T obj) { |
1629 | 1630 | } |
1630 | 1631 |
|
1631 | 1632 | final int maxIdle = getMaxIdlePerKey(); |
1632 | | - final LinkedBlockingDeque<PooledObject<T>> idleObjects = objectDeque.getIdleObjects(); |
| 1633 | + final BlockingDeque<PooledObject<T>> idleObjects = objectDeque.getIdleObjects(); |
1633 | 1634 |
|
1634 | 1635 | if (isClosed() || maxIdle > -1 && maxIdle <= idleObjects.size()) { |
1635 | 1636 | try { |
@@ -1674,7 +1675,7 @@ public void returnObject(final K key, final T obj) { |
1674 | 1675 | private void reuseCapacity() { |
1675 | 1676 | final int maxTotalPerKeySave = getMaxTotalPerKey(); |
1676 | 1677 | int maxQueueLength = 0; |
1677 | | - LinkedBlockingDeque<PooledObject<T>> mostLoadedPool = null; |
| 1678 | + BlockingDeque<PooledObject<T>> mostLoadedPool = null; |
1678 | 1679 | K mostLoadedKey = null; |
1679 | 1680 |
|
1680 | 1681 | // Find the most loaded pool that could take a new instance |
|
0 commit comments