Return-Path: X-Original-To: apmail-hbase-issues-archive@www.apache.org Delivered-To: apmail-hbase-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BE4F01853C for ; Mon, 21 Mar 2016 18:24:27 +0000 (UTC) Received: (qmail 85047 invoked by uid 500); 21 Mar 2016 18:24:26 -0000 Delivered-To: apmail-hbase-issues-archive@hbase.apache.org Received: (qmail 84971 invoked by uid 500); 21 Mar 2016 18:24:26 -0000 Mailing-List: contact issues-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@hbase.apache.org Received: (qmail 83710 invoked by uid 99); 21 Mar 2016 18:24:25 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Mar 2016 18:24:25 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 991E92C1F5A for ; Mon, 21 Mar 2016 18:24:25 +0000 (UTC) Date: Mon, 21 Mar 2016 18:24:25 +0000 (UTC) From: "Vladimir Rodionov (JIRA)" To: issues@hbase.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (HBASE-15501) MultiAction.add creates unnecessary temporary objects MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Vladimir Rodionov created HBASE-15501: ----------------------------------------- Summary: MultiAction.add creates unnecessary temporary objects Key: HBASE-15501 URL: https://issues.apache.org/jira/browse/HBASE-15501 Project: HBase Issue Type: Improvement Components: Client Affects Versions: 2.0.0 Reporter: Vladimir Rodionov Assignee: Vladimir Rodionov Fix For: 2.0.0 MultiAction class: {code} /** * Add an Action to this container based on it's regionName. If the regionName * is wrong, the initial execution will fail, but will be automatically * retried after looking up the correct region. * * @param regionName * @param a */ public void add(byte[] regionName, Action a) { add(regionName, Arrays.asList(a)); } /** * Add an Action to this container based on it's regionName. If the regionName * is wrong, the initial execution will fail, but will be automatically * retried after looking up the correct region. * * @param regionName * @param actionList list of actions to add for the region */ public void add(byte[] regionName, List> actionList){ List> rsActions = actions.get(regionName); if (rsActions == null) { rsActions = new ArrayList>(actionList.size()); actions.put(regionName, rsActions); } rsActions.addAll(actionList); } {code} Avoid Arrays.asList(a) and Collection.addAll - they create temporary garbage -- This message was sent by Atlassian JIRA (v6.3.4#6332)