You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2022/01/09 16:06:30 UTC

[httpcomponents-core] branch master updated: Remove conditions that always is 'true'.

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 087a100  Remove conditions that always is 'true'.
087a100 is described below

commit 087a1006adf9676e79539f890dd80c2321aba8dd
Author: Arturo Bernal <ar...@gmail.com>
AuthorDate: Sat Jan 8 22:29:32 2022 +0100

    Remove conditions that always is 'true'.
---
 .../src/main/java/org/apache/hc/core5/pool/StrictConnPool.java | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/httpcore5/src/main/java/org/apache/hc/core5/pool/StrictConnPool.java b/httpcore5/src/main/java/org/apache/hc/core5/pool/StrictConnPool.java
index c9cd8b4..93e1b31 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/pool/StrictConnPool.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/pool/StrictConnPool.java
@@ -367,12 +367,10 @@ public class StrictConnPool<T, C extends ModalCloseable> implements ManagedConnP
             }
             final int totalAvailable = this.available.size();
             if (totalAvailable > freeCapacity - 1) {
-                if (!this.available.isEmpty()) {
-                    final PoolEntry<T, C> lastUsed = this.available.removeLast();
-                    lastUsed.discardConnection(CloseMode.GRACEFUL);
-                    final PerRoutePool<T, C> otherpool = getPool(lastUsed.getRoute());
-                    otherpool.remove(lastUsed);
-                }
+                final PoolEntry<T, C> lastUsed = this.available.removeLast();
+                lastUsed.discardConnection(CloseMode.GRACEFUL);
+                final PerRoutePool<T, C> otherpool = getPool(lastUsed.getRoute());
+                otherpool.remove(lastUsed);
             }
 
             entry = pool.createEntry(this.timeToLive);