private T GetProxyInternal()
 {
     try
     {
         IPEndPoint rmAddress = rmProxy.GetRMAddress(conf, protocol);
         return(RMProxy.GetProxy(conf, protocol, rmAddress));
     }
     catch (IOException ioe)
     {
         Log.Error("Unable to create proxy to the ResourceManager " + rmServiceIds[currentProxyIndex
                   ], ioe);
         return(null);
     }
 }
        public virtual void Init(Configuration configuration, RMProxy <T> rmProxy, Type protocol
                                 )
        {
            this.rmProxy  = rmProxy;
            this.protocol = protocol;
            this.rmProxy.CheckAllowedProtocols(this.protocol);
            this.conf = new YarnConfiguration(configuration);
            ICollection <string> rmIds = HAUtil.GetRMHAIds(conf);

            this.rmServiceIds = Sharpen.Collections.ToArray(rmIds, new string[rmIds.Count]);
            conf.Set(YarnConfiguration.RmHaId, rmServiceIds[currentProxyIndex]);
            conf.SetInt(CommonConfigurationKeysPublic.IpcClientConnectMaxRetriesKey, conf.GetInt
                            (YarnConfiguration.ClientFailoverRetries, YarnConfiguration.DefaultClientFailoverRetries
                            ));
            conf.SetInt(CommonConfigurationKeysPublic.IpcClientConnectMaxRetriesOnSocketTimeoutsKey
                        , conf.GetInt(YarnConfiguration.ClientFailoverRetriesOnSocketTimeouts, YarnConfiguration
                                      .DefaultClientFailoverRetriesOnSocketTimeouts));
        }