Return-Path: X-Original-To: apmail-hadoop-common-issues-archive@minotaur.apache.org Delivered-To: apmail-hadoop-common-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5293EE8FA for ; Sat, 2 Feb 2013 06:20:17 +0000 (UTC) Received: (qmail 80023 invoked by uid 500); 2 Feb 2013 06:20:16 -0000 Delivered-To: apmail-hadoop-common-issues-archive@hadoop.apache.org Received: (qmail 79836 invoked by uid 500); 2 Feb 2013 06:20:16 -0000 Mailing-List: contact common-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-issues@hadoop.apache.org Delivered-To: mailing list common-issues@hadoop.apache.org Received: (qmail 79482 invoked by uid 99); 2 Feb 2013 06:20:14 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 02 Feb 2013 06:20:14 +0000 Date: Sat, 2 Feb 2013 06:20:13 +0000 (UTC) From: "Chris Nauroth (JIRA)" To: common-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HADOOP-9252) StringUtils.limitDecimalTo2(..) is unnecessarily synchronized MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HADOOP-9252?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13569449#comment-13569449 ] Chris Nauroth commented on HADOOP-9252: --------------------------------------- Thanks, Nicholas. I should have looked for the interface annotations. One of the test failures that I spotted was {{TestContainersMonitor}} in hadoop-yarn-server-nodemanager. The test failed because of 2 changes in behavior in {{StringUtils#humanReadableInt}} with this patch: # There is now a space between the number and the units. # The unit is upper-case instead of lower-case. For example, before the patch we would get results like "2.0m", and now we get "2.0 M". I made the test pass by removing the append of the extra space and wrapping the unit with {{Character#toLowerCase}}. The relevant lines in {{long2String}} with these changes are: {code} return (unit.isEmpty()? b: b.append(unit)).toString(); ... return b.append(Character.toLowerCase(prefix.symbol)).append(unit).toString(); {code} I did not do a complete test run though, so I don't know yet if my change introduced other problems. Would you want to incorporate something like this into the patch, or do you prefer to keep the new output and update any tests that depend on the old output? BTW, I ran a quick non-exhaustive grep of other Hadoop projects and found that HBase has calls to {{humanReadableInt}} and {{limitDecimalTo2}}. I don't know yet if there are any test impacts there. > StringUtils.limitDecimalTo2(..) is unnecessarily synchronized > ------------------------------------------------------------- > > Key: HADOOP-9252 > URL: https://issues.apache.org/jira/browse/HADOOP-9252 > Project: Hadoop Common > Issue Type: Improvement > Components: util > Reporter: Tsz Wo (Nicholas), SZE > Assignee: Tsz Wo (Nicholas), SZE > Priority: Minor > Attachments: c9252_20130127.patch, c9252_20130128.patch > > > limitDecimalTo2(double) currently uses decimalFormat, which is a static field, so that it is synchronized. Synchronization is unnecessary since it can simply uses String.format(..). -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira