Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 202D6200C7B for ; Sat, 20 May 2017 18:42:06 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 1EAEB160BBE; Sat, 20 May 2017 16:42:06 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 663BA160BA7 for ; Sat, 20 May 2017 18:42:05 +0200 (CEST) Received: (qmail 84402 invoked by uid 500); 20 May 2017 16:42:04 -0000 Mailing-List: contact commits-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list commits@hc.apache.org Received: (qmail 84390 invoked by uid 99); 20 May 2017 16:42:04 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 20 May 2017 16:42:04 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 7F845DFA33; Sat, 20 May 2017 16:42:04 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ggregory@apache.org To: commits@hc.apache.org Message-Id: <71ee841460aa452781fa86051a17d3a0@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: httpcomponents-core git commit: [HTTPCORE-470] Add a org.apache.http.nio.protocol.NullRequestHandler singleton. Date: Sat, 20 May 2017 16:42:04 +0000 (UTC) archived-at: Sat, 20 May 2017 16:42:06 -0000 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 Authored: Sat May 20 09:41:56 2017 -0700 Committer: Gary Gregory 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) 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 { + private static final NullRequestHandler INSTANCE = new NullRequestHandler(); + + /** + * @since 4.4.7 + */ + public static NullRequestHandler getInstance() { + return INSTANCE; + } + public NullRequestHandler() { super(); }