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 9DD7B200B21 for ; Fri, 10 Jun 2016 16:55:23 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 9C91C160A5B; Fri, 10 Jun 2016 14:55:23 +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 EC35D160A38 for ; Fri, 10 Jun 2016 16:55:22 +0200 (CEST) Received: (qmail 27012 invoked by uid 500); 10 Jun 2016 14:55:21 -0000 Mailing-List: contact yarn-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list yarn-issues@hadoop.apache.org Received: (qmail 26955 invoked by uid 99); 10 Jun 2016 14:55:21 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Jun 2016 14:55:21 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 202D42C1F64 for ; Fri, 10 Jun 2016 14:55:21 +0000 (UTC) Date: Fri, 10 Jun 2016 14:55:21 +0000 (UTC) From: "Joep Rottinghuis (JIRA)" To: yarn-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (YARN-5170) Eliminate singleton converters and static method access MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 10 Jun 2016 14:55:23 -0000 [ https://issues.apache.org/jira/browse/YARN-5170?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15324568#comment-15324568 ] Joep Rottinghuis commented on YARN-5170: ---------------------------------------- Thanks for tackling last static use and adjusting the comments [~varun_saxena] +1 on patch 13, it looks good to me. > Eliminate singleton converters and static method access > ------------------------------------------------------- > > Key: YARN-5170 > URL: https://issues.apache.org/jira/browse/YARN-5170 > Project: Hadoop YARN > Issue Type: Sub-task > Components: timelineserver > Affects Versions: YARN-2928 > Reporter: Joep Rottinghuis > Assignee: Joep Rottinghuis > Labels: yarn-2928-1st-milestone > Attachments: YARN-5170-YARN-2928.01.patch, YARN-5170-YARN-2928.02.patch, YARN-5170-YARN-2928.03.patch, YARN-5170-YARN-2928.04.patch, YARN-5170-YARN-2928.05.patch, YARN-5170-YARN-2928.06.patch, YARN-5170-YARN-2928.07.patch, YARN-5170-YARN-2928.08.patch, YARN-5170-YARN-2928.09.patch, YARN-5170-YARN-2928.10.patch, YARN-5170-YARN-2928.11.patch, YARN-5170-YARN-2928.12.patch, YARN-5170-YARN-2928.13.patch > > > As part of YARN-5109 we introduced several KeyConverter classes. > To stay consistent with the existing LongConverter in the sample patch I created I made these other converter classes singleton as well. > In conversation with [~sjlee0] who has a general dislike of singletons, we discussed it is best to get rid of these singletons and make them simply instance variables. > There are other classes where the keys have static methods referring to a singleton converter. > Moreover, it turns out that due to code evolution we end up creating the same keys several times. > So general approach is to not re-instantiate rowkeys, converters when not needed. > I would like to create the byte[] rowKey in the RowKey classes their constructor, but that would leak an incomplete object to the converter. > There are a few method in TimelineStorageUtils that are used only once, or only by one class, as part of this refactor I'll move these to keep the "Utils" class as small as possible and keep them for truly generally used utils that don't really belong anywhere else. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: yarn-issues-unsubscribe@hadoop.apache.org For additional commands, e-mail: yarn-issues-help@hadoop.apache.org