You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Liu Shaohui (JIRA)" <ji...@apache.org> on 2014/08/08 14:50:14 UTC

[jira] [Created] (HBASE-11707) Using Map instead of list in FailedServers of RpcClient

Liu Shaohui created HBASE-11707:
-----------------------------------

             Summary: Using Map instead of list in FailedServers of RpcClient
                 Key: HBASE-11707
                 URL: https://issues.apache.org/jira/browse/HBASE-11707
             Project: HBase
          Issue Type: Improvement
          Components: Client
            Reporter: Liu Shaohui
            Assignee: Liu Shaohui
            Priority: Minor


Currently, FailedServers uses a list to record the black list of servers and iterate the list to check if a server is in list. It's not efficient when the list is very large. And the list is not thread safe for the add and iteration operations.

RpcClient.java#175
{code}
      // iterate, looking for the search entry and cleaning expired entries
      Iterator<Pair<Long, String>> it = failedServers.iterator();
      while (it.hasNext()) {
        Pair<Long, String> cur = it.next();
         if (cur.getFirst() < now) {
          it.remove();
        } else {
          if (lookup.equals(cur.getSecond())) {
            return true;
          }
        }
{code}

A simple change is to change this list to ConcurrentHashMap.




--
This message was sent by Atlassian JIRA
(v6.2#6252)