You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-dev@hadoop.apache.org by "David Mollitor (Jira)" <ji...@apache.org> on 2019/09/11 01:20:00 UTC

[jira] [Created] (HDFS-14843) Double Synchronization in BlockReportLeaseManager

David Mollitor created HDFS-14843:
-------------------------------------

             Summary: Double Synchronization in BlockReportLeaseManager
                 Key: HDFS-14843
                 URL: https://issues.apache.org/jira/browse/HDFS-14843
             Project: Hadoop HDFS
          Issue Type: Improvement
            Reporter: David Mollitor


{code:java|title=BlockReportLeaseManager.java}
  private synchronized long getNextId() {
    long id;
    do {
      id = nextId++;
    } while (id == 0);
    return id;
  }
{code}

This is a private method and is synchronized, however, it is only be accessed from an already-synchronized method.  No need to double-synchronize.

https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockReportLeaseManager.java#L183-L189

https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockReportLeaseManager.java#L227



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-dev-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-dev-help@hadoop.apache.org