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 2017/05/20 16:42:04 UTC

httpcomponents-core git commit: [HTTPCORE-470] Add a org.apache.http.nio.protocol.NullRequestHandler singleton.

Repository: httpcomponents-core
Updated Branches:
  refs/heads/dev/4.4.x/HTTPCORE-470 [created] b1d60df91


[HTTPCORE-470] Add a org.apache.http.nio.protocol.NullRequestHandler
singleton.

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

Branch: refs/heads/dev/4.4.x/HTTPCORE-470
Commit: b1d60df91c3d03c261fdebdd59d298fb02f801bb
Parents: 4bbd024
Author: Gary Gregory <gg...@apache.org>
Authored: Sat May 20 09:41:56 2017 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Sat May 20 09:41:56 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/http/nio/protocol/HttpAsyncService.java | 2 +-
 .../org/apache/http/nio/protocol/NullRequestHandler.java    | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/b1d60df9/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
index 789b304..674d593 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
@@ -761,7 +761,7 @@ public class HttpAsyncService implements NHttpServerEventHandler {
             handler = (HttpAsyncRequestHandler<Object>) this.handlerMapper.lookup(request);
         }
         if (handler == null) {
-            handler = new NullRequestHandler();
+            handler = NullRequestHandler.getInstance();
         }
         return handler;
     }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/b1d60df9/httpcore-nio/src/main/java/org/apache/http/nio/protocol/NullRequestHandler.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/NullRequestHandler.java b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/NullRequestHandler.java
index 8d465e0..572cbc1 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/NullRequestHandler.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/NullRequestHandler.java
@@ -36,6 +36,15 @@ import org.apache.http.protocol.HttpContext;
 
 class NullRequestHandler implements HttpAsyncRequestHandler<Object> {
 
+    private static final NullRequestHandler INSTANCE = new NullRequestHandler();
+    
+    /**
+     * @since 4.4.7
+     */
+    public static NullRequestHandler getInstance() {
+        return INSTANCE;
+    }
+    
     public NullRequestHandler() {
         super();
     }