hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Íñigo Goiri (JIRA) <j...@apache.org>
Subject [jira] [Commented] (HDFS-14260) Synchronized Method in BlockReceiver Can Be Replaced with Atomic Value
Date Mon, 11 Feb 2019 17:44:00 GMT

    [ https://issues.apache.org/jira/browse/HDFS-14260?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16765210#comment-16765210
] 

Íñigo Goiri commented on HDFS-14260:
------------------------------------

+1 on [^HDFS-14260.2.patch].

> Synchronized Method in BlockReceiver Can Be Replaced with Atomic Value
> ----------------------------------------------------------------------
>
>                 Key: HDFS-14260
>                 URL: https://issues.apache.org/jira/browse/HDFS-14260
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: datanode
>    Affects Versions: 3.2.0
>            Reporter: BELUGA BEHR
>            Assignee: BELUGA BEHR
>            Priority: Minor
>         Attachments: HDFS-14260.1.patch, HDFS-14260.2.patch
>
>
> This synchronized block is protecting {{lastSentTime}} which is a native long.  Can use
AtomicLong and remove this synchronization.
> {code}
>   synchronized boolean packetSentInTime() {
>     long diff = Time.monotonicNow() - lastSentTime;
>     if (diff > maxSendIdleTime) {
>       LOG.info("A packet was last sent " + diff + " milliseconds ago.");
>       return false;
>     }
>     return true;
>   }
> {code}
> https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java#L392-L399



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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


Mime
View raw message