You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by gg...@apache.org on 2018/02/06 19:32:29 UTC

httpcomponents-core git commit: [HTTPCORE-511] Do not cache result of Runtime.getRuntime().availableProcessors() in IOReactorConfig.

Repository: httpcomponents-core
Updated Branches:
  refs/heads/4.4.x 1faf0976f -> b1b71bf0c


[HTTPCORE-511] Do not cache result of
Runtime.getRuntime().availableProcessors() in IOReactorConfig.

Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/b1b71bf0
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/b1b71bf0
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/b1b71bf0

Branch: refs/heads/4.4.x
Commit: b1b71bf0cc819e6690cf0a26e8d78027bd1f24a3
Parents: 1faf097
Author: Gary Gregory <ga...@gmail.com>
Authored: Tue Feb 6 12:32:26 2018 -0700
Committer: Gary Gregory <ga...@gmail.com>
Committed: Tue Feb 6 12:32:26 2018 -0700

----------------------------------------------------------------------
 RELEASE_NOTES.txt                                              | 3 +++
 .../java/org/apache/http/impl/nio/reactor/IOReactorConfig.java | 6 ++----
 2 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/b1b71bf0/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index d5118d5..49d4373 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -9,6 +9,9 @@ Changelog
 * HTTPCORE-510: Avoid an ArithmeticException in AbstractMultiworkerIOReactor by failing earlier by checking ioThreadCount in IOReactorConfig constructor.
   Contributed by Gary Gregory <ggregory at apache.org>
 
+* HTTPCORE-511: Do not cache result of Runtime.getRuntime().availableProcessors() in IOReactorConfig.
+  Contributed by Gary Gregory <ggregory at apache.org>
+
   
 Release 4.4.9
 -------------------

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/b1b71bf0/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOReactorConfig.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOReactorConfig.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOReactorConfig.java
index a4d7d3e..26fb11e 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOReactorConfig.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOReactorConfig.java
@@ -36,8 +36,6 @@ import org.apache.http.util.Args;
  */
 public final class IOReactorConfig implements Cloneable {
 
-    private static final int AVAIL_PROCS = Runtime.getRuntime().availableProcessors();
-
     public static final IOReactorConfig DEFAULT = new Builder().build();
 
     // TODO: make final
@@ -61,7 +59,7 @@ public final class IOReactorConfig implements Cloneable {
         this.selectInterval = 1000;
         this.shutdownGracePeriod = 500;
         this.interestOpQueued = false;
-        this.ioThreadCount = AVAIL_PROCS;
+        this.ioThreadCount = Runtime.getRuntime().availableProcessors();
         this.soTimeout = 0;
         this.soReuseAddress = false;
         this.soLinger = -1;
@@ -396,7 +394,7 @@ public final class IOReactorConfig implements Cloneable {
             this.selectInterval = 1000;
             this.shutdownGracePeriod = 500;
             this.interestOpQueued = false;
-            this.ioThreadCount = AVAIL_PROCS;
+            this.ioThreadCount = Runtime.getRuntime().availableProcessors();
             this.soTimeout = 0;
             this.soReuseAddress = false;
             this.soLinger = -1;