HDFS-16092. Avoid creating LayoutFlags redundant objects (#3150)

This commit is contained in:
Viraj Jasani 2021-06-29 15:01:02 +05:30 committed by GitHub
parent dc6f456e95
commit 93a1685073
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,14 +31,15 @@
*/
@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 " +
@ -47,7 +48,6 @@ public static LayoutFlags read(DataInputStream in)
throw new IOException("Found feature flags which we can't handle. " +
"Please upgrade your software.");
}
return new LayoutFlags();
}
private LayoutFlags() {