[
https://issues.apache.org/jira/browse/HBASE-10294?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13870806#comment-13870806
]
Ted Yu commented on HBASE-10294:
--------------------------------
At line 855, there is getOnlineServersList():
{code}
public List<ServerName> getOnlineServersList() {
// TODO: optimize the load balancer call so we don't need to make a new list
// TODO: FIX. THIS IS POPULAR CALL.
return new ArrayList<ServerName>(this.onlineServers.keySet());
}
{code}
Your comment applies to the above method as well, right ?
bq. rule whether or not the synchronization is needed (it looks like it is)
To see if I understand clearly, synchronization is needed w.r.t. accessing
onlineServers.
If so, I will put up a new patch.
Thanks
> Some synchronization on ServerManager#onlineServers can be removed
> ------------------------------------------------------------------
>
> Key: HBASE-10294
> URL: https://issues.apache.org/jira/browse/HBASE-10294
> Project: HBase
> Issue Type: Task
> Reporter: Ted Yu
> Assignee: Ted Yu
> Priority: Minor
> Fix For: 0.99.0
>
> Attachments: 10294-v1.txt
>
>
> ServerManager#onlineServers is a ConcurrentHashMap
> Yet I found that some accesses to it are synchronized and unnecessary.
> Here is one example:
> {code}
> public Map<ServerName, ServerLoad> getOnlineServers() {
> // Presumption is that iterating the returned Map is OK.
> synchronized (this.onlineServers) {
> return Collections.unmodifiableMap(this.onlineServers);
> {code}
> Note: not all accesses to ServerManager#onlineServers are synchronized.
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)