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 2019/11/04 09:55:30 UTC

[httpcomponents-core] branch HTTPASYNC-152 created (now a5defd9)

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

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


      at a5defd9  HTTPASYNC-152: non-blocking connection pool to automatically close all newly created sessions when being shut down

This branch includes the following new commits:

     new a5defd9  HTTPASYNC-152: non-blocking connection pool to automatically close all newly created sessions when being shut down

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[httpcomponents-core] 01/01: HTTPASYNC-152: non-blocking connection pool to automatically close all newly created sessions when being shut down

Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit a5defd98653b627a6bbf866895b96b56976dfb53
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Mon Nov 4 10:53:52 2019 +0100

    HTTPASYNC-152: non-blocking connection pool to automatically close all newly created sessions when being shut down
---
 .../main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java | 2 +-
 .../src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java   | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java
index d84faeb..10371b7 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java
@@ -425,7 +425,7 @@ public abstract class AbstractIOReactor implements IOReactor {
                     if (!sessionRequest.isTerminated()) {
                         sessionRequest.completed(session);
                     }
-                    if (!sessionRequest.isTerminated()) {
+                    if (!sessionRequest.isTerminated() && !session.isClosed()) {
                         sessionCreated(key, session);
                     }
                     if (sessionRequest.isTerminated()) {
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 1bddff6..3387178 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
@@ -543,6 +543,10 @@ public abstract class AbstractNIOConnPool<T, C, E extends PoolEntry<T, C>>
 
     protected void requestCompleted(final SessionRequest request) {
         if (this.isShutDown.get()) {
+            final IOSession session = request.getSession();
+            if (session != null) {
+                session.close();
+            }
             return;
         }
         @SuppressWarnings("unchecked")