[ 
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)

Reply via email to