hbase-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vladimir Rodionov (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HBASE-15501) MultiAction.add creates unnecessary temporary objects
Date Mon, 21 Mar 2016 18:24:25 GMT
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<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.3.4#6332)

Mime
View raw message