You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by we...@apache.org on 2021/06/29 10:14:17 UTC

[hadoop] branch branch-3.2 updated: HDFS-16092. Avoid creating LayoutFlags redundant objects (#3150)

This is an automated email from the ASF dual-hosted git repository.

weichiu pushed a commit to branch branch-3.2
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/branch-3.2 by this push:
     new 707d003  HDFS-16092. Avoid creating LayoutFlags redundant objects (#3150)
707d003 is described below

commit 707d003eb6213bc4e11bc203e5f1f3ab8ee3dbd9
Author: Viraj Jasani <vj...@apache.org>
AuthorDate: Tue Jun 29 15:01:02 2021 +0530

    HDFS-16092. Avoid creating LayoutFlags redundant objects (#3150)
    
    (cherry picked from commit 93a1685073d76bef5c6ad3819e7710317733bd7a)
    (cherry picked from commit 8538881710df3dd33ab23670d50d1b0119930169)
---
 .../main/java/org/apache/hadoop/hdfs/protocol/LayoutFlags.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/LayoutFlags.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/LayoutFlags.java
index fc1717f..3a7ccf1 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/LayoutFlags.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/LayoutFlags.java
@@ -36,14 +36,15 @@ import com.google.common.collect.Sets;
  */
 @InterfaceAudience.Private
 public class LayoutFlags {
+
   /**
-   * Load a LayoutFlags object from a stream.
+   * Read next int from given input stream. If the value is not 0 (unsupported
+   * feature flags), throw appropriate IOException.
    *
    * @param in            The stream to read from.
-   * @throws IOException
+   * @throws IOException  If next byte read from given stream is not 0.
    */
-  public static LayoutFlags read(DataInputStream in)
-      throws IOException {
+  public static void read(DataInputStream in) throws IOException {
     int length = in.readInt();
     if (length < 0) {
       throw new IOException("The length of the feature flag section " +
@@ -52,7 +53,6 @@ public class LayoutFlags {
       throw new IOException("Found feature flags which we can't handle. " +
           "Please upgrade your software.");
     }
-    return new LayoutFlags();
   }
 
   private LayoutFlags() {

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