[ https://issues.apache.org/jira/browse/HDFS-10750?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15417666#comment-15417666 ]
Vrushali C commented on HDFS-10750: ----------------------------------- Pasting a patch here, I can't upload a file to HDFS jiras yet. I also fixed several other same calls in this file as well. {code} diff --git hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java index ae7a937..0b5b211 100644 --- hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java +++ hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java @@ -656,7 +656,7 @@ NamenodeRegistration getRegistration() { NamenodeRegistration setRegistration() { nodeRegistration = new NamenodeRegistration( - NetUtils.getHostPortString(rpcServer.getRpcAddress()), + NetUtils.getHostPortString(getNameNodeAddress()), NetUtils.getHostPortString(getHttpAddress()), getFSImage().getStorage(), getRole()); return nodeRegistration; @@ -719,7 +719,7 @@ protected void initialize(Configuration conf) throws IOException { // This is expected for MiniDFSCluster. Set it now using // the RPC server's bind address. clientNamenodeAddress = - NetUtils.getHostPortString(rpcServer.getRpcAddress()); + NetUtils.getHostPortString(getNameNodeAddress()); LOG.info("Clients are to use " + clientNamenodeAddress + " to access" + " this namenode/service."); } @@ -806,7 +806,7 @@ private void startCommonServices(Configuration conf) throws IOException { LOG.warn("ServicePlugin " + p + " could not be started", t); } } - LOG.info(getRole() + " RPC up at: " + rpcServer.getRpcAddress()); + LOG.info(getRole() + " RPC up at: " + getNameNodeAddress()); if (rpcServer.getServiceRpcAddress() != null) { LOG.info(getRole() + " service RPC up at: " + rpcServer.getServiceRpcAddress()); @@ -1037,7 +1037,7 @@ public InetSocketAddress getNameNodeAddress() { * @return NameNode RPC address in "host:port" string form */ public String getNameNodeAddressHostPortString() { - return NetUtils.getHostPortString(rpcServer.getRpcAddress()); + return NetUtils.getHostPortString(getNameNodeAddress()); } /** @@ -1046,7 +1046,7 @@ public String getNameNodeAddressHostPortString() { */ public InetSocketAddress getServiceRpcAddress() { final InetSocketAddress serviceAddr = rpcServer.getServiceRpcAddress(); - return serviceAddr == null ? rpcServer.getRpcAddress() : serviceAddr; + return serviceAddr == null ? getNameNodeAddress() : serviceAddr; } /** {code} > Log refactoring: method invocation should be replaced by a shorter method > ------------------------------------------------------------------------- > > Key: HDFS-10750 > URL: https://issues.apache.org/jira/browse/HDFS-10750 > Project: Hadoop HDFS > Issue Type: Bug > Affects Versions: 2.7.2 > Reporter: Nemo Chen > Labels: easyfix, easytest > > Similar to the fix for AVRO-115. In file: > hadoop-rel-release-2.7.2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java > in line 695, the logging code: > {code:borderStyle=solid} > LOG.info(getRole() + " RPC up at: " + rpcServer.getRpcAddress()); > {code} > In the same class, there is a method in line 907: > {code:borderStyle=solid} > /** > * @return NameNode RPC address > */ > public InetSocketAddress getNameNodeAddress() { > return rpcServer.getRpcAddress(); > } > {code} > We can tell that rpcServer.getRpcAddress() could be replaced by method > getNameNodeAddress() for the case of readability and simplicity -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org