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/10/29 08:32:38 UTC
[httpcomponents-core] branch 5.1.x updated: remove unnecessary if statement
This is an automated email from the ASF dual-hosted git repository.
olegk pushed a commit to branch 5.1.x
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git
The following commit(s) were added to refs/heads/5.1.x by this push:
new 4ecdbd93f remove unnecessary if statement
4ecdbd93f is described below
commit 4ecdbd93fe6f98f1250c7c83fc104b3d25a22f44
Author: lijianyu <lj...@foxmail.com>
AuthorDate: Sat Oct 29 11:29:00 2022 +0800
remove unnecessary if statement
---
.../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 3ad6cd0c4..fa8f8f4d7 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);