/// <summary>Helper method to create FailoverProxyProvider.</summary> private RMFailoverProxyProvider <T> CreateRMFailoverProxyProvider <T>(Configuration conf) { System.Type protocol = typeof(T); Type defaultProviderClass; try { defaultProviderClass = (Type)Sharpen.Runtime.GetType(YarnConfiguration.DefaultClientFailoverProxyProvider ); } catch (Exception e) { throw new YarnRuntimeException("Invalid default failover provider class" + YarnConfiguration .DefaultClientFailoverProxyProvider, e); } RMFailoverProxyProvider <T> provider = ReflectionUtils.NewInstance(conf.GetClass <RMFailoverProxyProvider >(YarnConfiguration.ClientFailoverProxyProvider, defaultProviderClass), conf); provider.Init(conf, (Org.Apache.Hadoop.Yarn.Client.RMProxy <T>) this, protocol); return(provider); }
protected internal static T CreateRMProxy <T>(Configuration configuration, Org.Apache.Hadoop.Yarn.Client.RMProxy instance) { System.Type protocol = typeof(T); YarnConfiguration conf = (configuration is YarnConfiguration) ? (YarnConfiguration )configuration : new YarnConfiguration(configuration); RetryPolicy retryPolicy = CreateRetryPolicy(conf); if (HAUtil.IsHAEnabled(conf)) { RMFailoverProxyProvider <T> provider = instance.CreateRMFailoverProxyProvider(conf , protocol); return((T)RetryProxy.Create(protocol, provider, retryPolicy)); } else { IPEndPoint rmAddress = instance.GetRMAddress(conf, protocol); Log.Info("Connecting to ResourceManager at " + rmAddress); T proxy = Org.Apache.Hadoop.Yarn.Client.RMProxy.GetProxy <T>(conf, protocol, rmAddress ); return((T)RetryProxy.Create(protocol, proxy, retryPolicy)); } }