Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-14260

Replace synchronized method in BlockReceiver with atomic value

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.2.0
    • 3.3.0
    • datanode
    • None
    • Reviewed

    Description

      This synchronized block is protecting lastSentTime which is a native long. Can use AtomicLong and remove this synchronization.

        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;
        }
      

      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

      Attachments

        1. HDFS-14260.2.patch
          3 kB
          David Mollitor
        2. HDFS-14260.1.patch
          3 kB
          David Mollitor

        Issue Links

          Activity

            People

              belugabehr David Mollitor
              belugabehr David Mollitor
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: