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 BBB4D200B4A for ; Wed, 20 Jul 2016 14:07:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id BA385160A8B; Wed, 20 Jul 2016 12:07:22 +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 3DCAB160A7C for ; Wed, 20 Jul 2016 14:07:22 +0200 (CEST) Received: (qmail 27150 invoked by uid 500); 20 Jul 2016 12:07:21 -0000 Mailing-List: contact hdfs-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list hdfs-issues@hadoop.apache.org Received: (qmail 26998 invoked by uid 99); 20 Jul 2016 12:07:21 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Jul 2016 12:07:21 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 06A872C0D5A for ; Wed, 20 Jul 2016 12:07:21 +0000 (UTC) Date: Wed, 20 Jul 2016 12:07:21 +0000 (UTC) From: "Yiqun Lin (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (HDFS-10658) Reduce JsonFactory instance allocation in StartupProgressServlet MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 20 Jul 2016 12:07:22 -0000 Yiqun Lin created HDFS-10658: -------------------------------- Summary: Reduce JsonFactory instance allocation in StartupProgressServlet Key: HDFS-10658 URL: https://issues.apache.org/jira/browse/HDFS-10658 Project: Hadoop HDFS Issue Type: Bug Reporter: Yiqun Lin Assignee: Yiqun Lin Now in class {{StartupProgressServlet}}, it will always create a new {{JsonFactory}} instance to create a JsonGenerator. The codes: {code} protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setContentType("application/json; charset=UTF-8"); StartupProgress prog = NameNodeHttpServer.getStartupProgressFromContext( getServletContext()); StartupProgressView view = prog.createView(); JsonGenerator json = new JsonFactory().createJsonGenerator(resp.getWriter()); try { json.writeStartObject(); json.writeNumberField(ELAPSED_TIME, view.getElapsedTime()); json.writeNumberField(PERCENT_COMPLETE, view.getPercentComplete()); json.writeArrayFieldStart(PHASES); ... {code} We can reuse the instance and reduce {{JsonFactory instance}} allocation. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org