[prev in list] [next in list] [prev in thread] [next in thread] 

List:       httpcomponents-commits
Subject:    [httpcomponents-core] branch 4.4.x updated: remove unnecessary if statement
From:       olegk () apache ! org
Date:       2022-10-29 8:24:37
Message-ID: 166703187750.679258.17806510466074929356 () gitbox2-he-fi ! apache ! org
[Download RAW message or body]

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

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


The following commit(s) were added to refs/heads/4.4.x by this push:
     new 9f92aea45 remove unnecessary if statement
9f92aea45 is described below

commit 9f92aea45dc91f61890bda89afded400ab9236dc
Author: lijianyu <ljy5490@foxmail.com>
AuthorDate: Sat Oct 29 11:29:00 2022 +0800

    remove unnecessary if statement
---
 .../java/org/apache/http/nio/pool/AbstractNIOConnPool.java     | 10 ++++------
 .../src/main/java/org/apache/http/pool/AbstractConnPool.java   | 10 ++++------
 2 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java \
b/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java index \
                338717877..9a640a111 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
@@ -460,12 +460,10 @@ public abstract class AbstractNIOConnPool<T, C, E extends \
PoolEntry<T, C>>  }
             final int totalAvailable = this.available.size();
             if (totalAvailable > freeCapacity - 1) {
-                if (!this.available.isEmpty()) {
-                    final E lastUsed = this.available.removeLast();
-                    lastUsed.close();
-                    final RouteSpecificPool<T, C, E> otherpool = \
                getPool(lastUsed.getRoute());
-                    otherpool.remove(lastUsed);
-                }
+                final E lastUsed = this.available.removeLast();
+                lastUsed.close();
+                final RouteSpecificPool<T, C, E> otherpool = \
getPool(lastUsed.getRoute()); +                otherpool.remove(lastUsed);
             }
 
             final SocketAddress localAddress;
diff --git a/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java \
b/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java index \
                7d8041d92..b771d7f08 100644
--- a/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
+++ b/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
@@ -369,12 +369,10 @@ public abstract class AbstractConnPool<T, C, E extends \
PoolEntry<T, C>>  if (freeCapacity > 0) {
                         final int totalAvailable = this.available.size();
                         if (totalAvailable > freeCapacity - 1) {
-                            if (!this.available.isEmpty()) {
-                                final E lastUsed = this.available.removeLast();
-                                lastUsed.close();
-                                final RouteSpecificPool<T, C, E> otherpool = \
                getPool(lastUsed.getRoute());
-                                otherpool.remove(lastUsed);
-                            }
+                            final E lastUsed = this.available.removeLast();
+                            lastUsed.close();
+                            final RouteSpecificPool<T, C, E> otherpool = \
getPool(lastUsed.getRoute()); +                            \
otherpool.remove(lastUsed);  }
                         final C conn = this.connFactory.create(route);
                         entry = pool.add(conn);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic