hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ted Yu (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-10294) Some synchronization on ServerManager#onlineServers can be removed
Date Tue, 14 Jan 2014 17:34:56 GMT

    [ https://issues.apache.org/jira/browse/HBASE-10294?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13870941#comment-13870941

Ted Yu commented on HBASE-10294:

The following FindBugs warning led me to look at getOnlineServers() :

FindBugs: Multithreaded correctness
JLM: Synchronization on java.util.concurrent objects
This method performs synchronization an object that is an instance of a class from the java.util.concurrent
package (or its subclasses).

The comment about getOnlineServersList() is that there is already code in ServerManager which
iterates onlineServers without using synchronized.

Liang and Sergey both confirmed that synchronized in getOnlineServers() is not needed.

> 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

View raw message