Skip to content

Commit 310f7ca

Browse files
committed
Type to the interface where we can
1 parent a205ed9 commit 310f7ca

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.util.NoSuchElementException;
2929
import java.util.Objects;
3030
import java.util.TreeMap;
31+
import java.util.concurrent.BlockingDeque;
3132
import java.util.concurrent.ConcurrentHashMap;
3233
import java.util.concurrent.atomic.AtomicBoolean;
3334
import java.util.concurrent.atomic.AtomicInteger;
@@ -310,7 +311,7 @@ public GenericKeyedObjectPool(final KeyedPooledObjectFactory<K, T> factory,
310311
private void addIdleObject(final K key, final PooledObject<T> p) throws Exception {
311312
if (PooledObject.nonNull(p)) {
312313
factory.passivateObject(key, p);
313-
final LinkedBlockingDeque<PooledObject<T>> idleObjects = poolMap.get(key).getIdleObjects();
314+
final BlockingDeque<PooledObject<T>> idleObjects = poolMap.get(key).getIdleObjects();
314315
if (getLifo()) {
315316
idleObjects.addFirst(p);
316317
} else {
@@ -697,7 +698,7 @@ public void clear(final K key, final boolean reuseCapacity) {
697698
final ObjectDeque<T> objectDeque = register(key);
698699
int freedCapacity = 0;
699700
try {
700-
final LinkedBlockingDeque<PooledObject<T>> idleObjects = objectDeque.getIdleObjects();
701+
final BlockingDeque<PooledObject<T>> idleObjects = objectDeque.getIdleObjects();
701702
PooledObject<T> p = idleObjects.poll();
702703
while (p != null) {
703704
try {
@@ -1629,7 +1630,7 @@ public void returnObject(final K key, final T obj) {
16291630
}
16301631

16311632
final int maxIdle = getMaxIdlePerKey();
1632-
final LinkedBlockingDeque<PooledObject<T>> idleObjects = objectDeque.getIdleObjects();
1633+
final BlockingDeque<PooledObject<T>> idleObjects = objectDeque.getIdleObjects();
16331634

16341635
if (isClosed() || maxIdle > -1 && maxIdle <= idleObjects.size()) {
16351636
try {
@@ -1674,7 +1675,7 @@ public void returnObject(final K key, final T obj) {
16741675
private void reuseCapacity() {
16751676
final int maxTotalPerKeySave = getMaxTotalPerKey();
16761677
int maxQueueLength = 0;
1677-
LinkedBlockingDeque<PooledObject<T>> mostLoadedPool = null;
1678+
BlockingDeque<PooledObject<T>> mostLoadedPool = null;
16781679
K mostLoadedKey = null;
16791680

16801681
// Find the most loaded pool that could take a new instance

0 commit comments

Comments
 (0)