[ 
https://issues.apache.org/jira/browse/YARN-513?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13648075#comment-13648075
 ] 

Bikas Saha commented on YARN-513:
---------------------------------



This will not work since for different protocols we have different ports on the 
RM. rmAddress cannot be passed into the methdo. Also, for failover case, the 
rmAddress needs to be determined internally. Based on protocol we need to find 
the correct address etc from conf and create the correct proxy object.
{code}
+  public static <T> T createRMProxy(final Configuration conf,
+      final Class<T> protocol, final InetSocketAddress rmAddress)
{code}

Can this code be written in the formate if(waitForever) {} else {}? It may be 
simpler
{code}
+    RetryPolicy retryPolicy =
+        (waitForEver) ? RetryPolicies.RETRY_FOREVER :
+            RetryPolicies.retryUpToMaximumTimeWithFixedSleep(rmConnectWaitMS,
+                rmConnectionRetryIntervalMS,
+                TimeUnit.MILLISECONDS);
+    Map<Class<? extends Exception>, RetryPolicy> exceptionToPolicyMap =
+        new HashMap<Class<? extends Exception>, RetryPolicy>();
+    exceptionToPolicyMap.put(java.net.ConnectException.class, retryPolicy);
+    exceptionToPolicyMap.put(java.io.EOFException.class, retryPolicy);
+    return (waitForEver) ? RetryPolicies.RETRY_FOREVER :
+        RetryPolicies.retryByException(
+            retryPolicy, exceptionToPolicyMap);
{code}


Same retryPolicy is being passed into exceptionmap and as the default value. 
Whats the use of the exceptionmap then?
{code}
+        RetryPolicies.retryByException(
+            retryPolicy, exceptionToPolicyMap);
{code}

Any way to keep diagnostic error messages?

I think if we dont rename NMStatusUpdater.getRMClient to createRMPRoxy then we 
dont need LocalRMProxy and most of the test code changes will also disappear.
{code}
-  protected ResourceTracker getRMClient() {
-    Configuration conf = getConfig();
-    YarnRPC rpc = YarnRPC.create(conf);
-    return (ResourceTracker) rpc.getProxy(ResourceTracker.class, rmAddress,
-        conf);
+  @VisibleForTesting
+  protected ResourceTracker createRMProxy(Configuration conf)
+      throws IOException {
+    return RMProxy.createRMProxy(conf, ResourceTracker.class, rmAddress);
   }
{code}
                
> Create common proxy client for communicating with RM
> ----------------------------------------------------
>
>                 Key: YARN-513
>                 URL: https://issues.apache.org/jira/browse/YARN-513
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>          Components: resourcemanager
>            Reporter: Bikas Saha
>            Assignee: Xuan Gong
>         Attachments: YARN-513.1.patch, YARN-513.2.patch, YARN-513.3.patch, 
> YARN-513.4.patch, YARN.513.5.patch, YARN-513.6.patch
>
>
> When the RM is restarting, the NM, AM and Clients should wait for some time 
> for the RM to come back up.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to