diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/CodecRegistry.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/CodecRegistry.java index fcf13492f7..daf91e22ec 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/CodecRegistry.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/CodecRegistry.java @@ -176,7 +176,7 @@ public RawErasureCoderFactory getCoderByName( * @return a map of all codec names, and their corresponding code list * separated by ','. */ - public HashMap getCodec2CoderCompactMap() { + public Map getCodec2CoderCompactMap() { return coderNameCompactMap; } } diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSClient.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSClient.java index 88b273a08c..969522dde9 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSClient.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSClient.java @@ -2764,7 +2764,7 @@ public ErasureCodingPolicy[] getErasureCodingPolicies() throws IOException { } } - public HashMap getErasureCodingCodecs() throws IOException { + public Map getErasureCodingCodecs() throws IOException { checkOpen(); try (TraceScope ignored = tracer.newScope("getErasureCodingCodecs")) { return namenode.getErasureCodingCodecs(); diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java index cd368d4de9..8f82d03dbe 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java @@ -26,7 +26,6 @@ import java.util.Arrays; import java.util.Collection; import java.util.EnumSet; -import java.util.HashMap; import java.util.List; import java.util.Map; @@ -2585,7 +2584,7 @@ public Collection getAllErasureCodingPolicies() * @return all erasure coding codecs and coders supported by this file system. * @throws IOException */ - public HashMap getAllErasureCodingCodecs() + public Map getAllErasureCodingCodecs() throws IOException { return dfs.getErasureCodingCodecs(); } diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java index 45c6b3269b..eb9380d345 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java @@ -19,8 +19,8 @@ import java.io.IOException; import java.util.EnumSet; -import java.util.HashMap; import java.util.List; +import java.util.Map; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; @@ -1601,7 +1601,7 @@ AddECPolicyResponse[] addErasureCodingPolicies( * @throws IOException */ @Idempotent - HashMap getErasureCodingCodecs() throws IOException; + Map getErasureCodingCodecs() throws IOException; /** * Get the information about the EC policy for the path. diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolTranslatorPB.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolTranslatorPB.java index aed41176e1..ac06c1ade8 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolTranslatorPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolTranslatorPB.java @@ -26,6 +26,7 @@ import com.google.common.collect.Lists; +import java.util.Map; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; @@ -1760,11 +1761,11 @@ public ErasureCodingPolicy[] getErasureCodingPolicies() throws IOException { } @Override - public HashMap getErasureCodingCodecs() throws IOException { + public Map getErasureCodingCodecs() throws IOException { try { GetErasureCodingCodecsResponseProto response = rpcProxy .getErasureCodingCodecs(null, VOID_GET_EC_CODEC_REQUEST); - HashMap ecCodecs = new HashMap(); + Map ecCodecs = new HashMap<>(); for (CodecProto codec : response.getCodecList()) { ecCodecs.put(codec.getCodec(), codec.getCoders()); } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolServerSideTranslatorPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolServerSideTranslatorPB.java index 38b81c68c6..a446276902 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolServerSideTranslatorPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolServerSideTranslatorPB.java @@ -21,7 +21,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.EnumSet; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -1664,7 +1663,7 @@ public GetErasureCodingCodecsResponseProto getErasureCodingCodecs( RpcController controller, GetErasureCodingCodecsRequestProto request) throws ServiceException { try { - HashMap codecs = server.getErasureCodingCodecs(); + Map codecs = server.getErasureCodingCodecs(); GetErasureCodingCodecsResponseProto.Builder resBuilder = GetErasureCodingCodecsResponseProto.newBuilder(); for (Map.Entry codec : codecs.entrySet()) { diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirErasureCodingOp.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirErasureCodingOp.java index 486503cbf7..7895433e1f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirErasureCodingOp.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirErasureCodingOp.java @@ -25,8 +25,8 @@ import java.io.IOException; import java.util.Arrays; import java.util.EnumSet; -import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; import com.google.common.base.Preconditions; @@ -344,7 +344,7 @@ static ErasureCodingPolicy[] getErasureCodingPolicies(final FSNamesystem fsn) * @param fsn namespace * @return {@link java.util.HashMap} array */ - static HashMap getErasureCodingCodecs(final FSNamesystem fsn) + static Map getErasureCodingCodecs(final FSNamesystem fsn) throws IOException { assert fsn.hasReadLock(); return CodecRegistry.getInstance().getCodec2CoderCompactMap(); diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java index 1cfaa54962..2313335d6a 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java @@ -7255,14 +7255,14 @@ ErasureCodingPolicy[] getErasureCodingPolicies() throws IOException { /** * Get available erasure coding codecs and corresponding coders. */ - HashMap getErasureCodingCodecs() throws IOException { + Map getErasureCodingCodecs() throws IOException { final String operationName = "getErasureCodingCodecs"; boolean success = false; checkOperation(OperationCategory.READ); readLock(); try { checkOperation(OperationCategory.READ); - final HashMap ret = + final Map ret = FSDirErasureCodingOp.getErasureCodingCodecs(this); success = true; return ret; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeRpcServer.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeRpcServer.java index d304d3dd29..7871202006 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeRpcServer.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeRpcServer.java @@ -37,9 +37,9 @@ import java.util.Arrays; import java.util.Collection; import java.util.EnumSet; -import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; import java.util.concurrent.Callable; @@ -2278,7 +2278,7 @@ public ErasureCodingPolicy[] getErasureCodingPolicies() throws IOException { } @Override // ClientProtocol - public HashMap getErasureCodingCodecs() throws IOException { + public Map getErasureCodingCodecs() throws IOException { checkNNStartup(); return namesystem.getErasureCodingCodecs(); } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/ECAdmin.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/ECAdmin.java index 46600a0f3a..17a84f9ca1 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/ECAdmin.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/ECAdmin.java @@ -33,7 +33,6 @@ import java.io.IOException; import java.util.Arrays; import java.util.Collection; -import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -441,7 +440,7 @@ public int run(Configuration conf, List args) throws IOException { final DistributedFileSystem dfs = AdminHelper.getDFS(conf); try { - HashMap codecs = + Map codecs = dfs.getAllErasureCodingCodecs(); if (codecs.isEmpty()) { System.out.println("No erasure coding codecs are supported on the " + diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestErasureCodingPolicies.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestErasureCodingPolicies.java index 06edb1a4d7..22e118fa11 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestErasureCodingPolicies.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestErasureCodingPolicies.java @@ -50,8 +50,8 @@ import java.security.PrivilegedExceptionAction; import java.util.Collection; import java.util.EnumSet; -import java.util.HashMap; import java.util.List; +import java.util.Map; import static org.apache.hadoop.test.GenericTestUtils.assertExceptionContains; import static org.junit.Assert.*; @@ -647,7 +647,7 @@ public void testEnforceAsReplicatedFile() throws Exception { @Test public void testGetAllErasureCodingCodecs() throws Exception { - HashMap allECCodecs = fs + Map allECCodecs = fs .getAllErasureCodingCodecs(); assertTrue("At least 3 system codecs should be enabled", allECCodecs.size() >= 3);