goiri commented on a change in pull request #3878:
URL: https://github.com/apache/hadoop/pull/3878#discussion_r785160760



##########
File path: 
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/Router.java
##########
@@ -386,6 +380,26 @@ public void run() {
   // RPC Server
   /////////////////////////////////////////////////////////
 
+  private void setRpcServer() throws IOException {
+    if (conf.getBoolean(
+            RBFConfigKeys.DFS_ROUTER_RPC_ENABLE,
+            RBFConfigKeys.DFS_ROUTER_RPC_ENABLE_DEFAULT)) {
+      // Create RPC server
+      this.rpcServer = createRpcServer();
+      addService(this.rpcServer);
+      this.setRpcServerAddress(rpcServer.getRpcAddress());
+    } else {
+      InetSocketAddress confRpcAddress = conf.getSocketAddr(
+              RBFConfigKeys.DFS_ROUTER_RPC_BIND_HOST_KEY,
+              RBFConfigKeys.DFS_ROUTER_RPC_ADDRESS_KEY,
+              RBFConfigKeys.DFS_ROUTER_RPC_ADDRESS_DEFAULT,
+              RBFConfigKeys.DFS_ROUTER_RPC_PORT_DEFAULT);
+
+      String hostname = InetAddress.getLocalHost().getHostName();

Review comment:
       Most of this is already defined in setRpcServerAddress() and it even 
considers exception, etc.
   I would refactor that function to allow specifying a customized port.
   
   In any case, I would leave the general code as it was, and then after that, 
check if routerId is null,  and then set it to this.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to