hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "stack (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (HBASE-15501) MultiAction.add creates unnecessary temporary objects
Date Fri, 30 Jun 2017 10:44:00 GMT

     [ https://issues.apache.org/jira/browse/HBASE-15501?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

stack updated HBASE-15501:
--------------------------
    Fix Version/s:     (was: 2.0.0)

> 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
>         Attachments: HBASE-15501-v1.patch
>
>
> 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<R> 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<Action<R>> actionList){
>     List<Action<R>> rsActions = actions.get(regionName);
>     if (rsActions == null) {
>       rsActions = new ArrayList<Action<R>>(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.4.14#64029)

Mime
View raw message