Package org.apache.hadoop.yarn.client
Class RMProxy<T>
java.lang.Object
org.apache.hadoop.yarn.client.RMProxy<T>
- Direct Known Subclasses:
ClientRMProxy
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckAllowedProtocols(Class<?> protocol) Verify the passed protocol is supported.static org.apache.hadoop.io.retry.RetryPolicycreateRetryPolicy(Configuration conf, boolean isHAEnabled) Fetch retry policy from Configuration.protected static org.apache.hadoop.io.retry.RetryPolicycreateRetryPolicy(Configuration conf, long retryTime, long retryInterval, boolean isHAEnabled) Fetch retry policy from Configuration and create the retry policy with specified retryTime and retry interval.protected static <T> TcreateRMProxy(Configuration configuration, Class<T> protocol, RMProxy<T> instance) Currently, used by Client and AM only Create a proxy for the specified protocol.protected static <T> TcreateRMProxy(Configuration configuration, Class<T> protocol, RMProxy<T> instance, long retryTime, long retryInterval) Currently, used by NodeManagers only.protected static <T> TcreateRMProxyFederation(Configuration configuration, Class<T> protocol, RMProxy<T> instance) This functionality is only used for NodeManager and only in non-HA mode.<T> TgetProxy(Configuration conf, Class<T> protocol, InetSocketAddress rmAddress) Get a proxy to the RM at the specified address.getRMAddress(YarnConfiguration conf, Class<?> protocol) Get the ResourceManager address from the provided Configuration for the given protocol.protected static <T> org.apache.hadoop.yarn.client.RMFailoverProxyProvider<T>getRMFailoverProxyProvider(YarnConfiguration conf, Class<T> protocol, RMProxy<T> instance) protected static <T> TnewProxyInstanceFederation(YarnConfiguration conf, Class<T> protocol, RMProxy<T> instance, org.apache.hadoop.io.retry.RetryPolicy retryPolicy)
-
Constructor Details
-
RMProxy
protected RMProxy()
-
-
Method Details
-
checkAllowedProtocols
Verify the passed protocol is supported.- Parameters:
protocol- protocol.
-
getRMAddress
@Private public InetSocketAddress getRMAddress(YarnConfiguration conf, Class<?> protocol) throws IOException Get the ResourceManager address from the provided Configuration for the given protocol.- Parameters:
conf- configuration.protocol- protocol.- Returns:
- inet socket address.
- Throws:
IOException- io error occur.
-
createRMProxy
@Private protected static <T> T createRMProxy(Configuration configuration, Class<T> protocol, RMProxy<T> instance) throws IOException Currently, used by Client and AM only Create a proxy for the specified protocol. For non-HA, this is a direct connection to the ResourceManager address. When HA is enabled, the proxy handles the failover between the ResourceManagers as well.- Type Parameters:
T- Generic T.- Parameters:
configuration- configuration.protocol- protocol.instance- RMProxy instance.- Returns:
- RMProxy.
- Throws:
IOException- io error occur.
-
createRMProxyFederation
protected static <T> T createRMProxyFederation(Configuration configuration, Class<T> protocol, RMProxy<T> instance) throws IOException This functionality is only used for NodeManager and only in non-HA mode. Its purpose is to ensure that when initializes UAM, it can find the correct cluster.- Type Parameters:
T- Generic T.- Parameters:
configuration- configuration.protocol- protocol.instance- RMProxy instance.- Returns:
- RMProxy.
- Throws:
IOException- io error occur.
-
newProxyInstanceFederation
protected static <T> T newProxyInstanceFederation(YarnConfiguration conf, Class<T> protocol, RMProxy<T> instance, org.apache.hadoop.io.retry.RetryPolicy retryPolicy) -
getRMFailoverProxyProvider
protected static <T> org.apache.hadoop.yarn.client.RMFailoverProxyProvider<T> getRMFailoverProxyProvider(YarnConfiguration conf, Class<T> protocol, RMProxy<T> instance) -
createRMProxy
@Private protected static <T> T createRMProxy(Configuration configuration, Class<T> protocol, RMProxy<T> instance, long retryTime, long retryInterval) throws IOException Currently, used by NodeManagers only. Create a proxy for the specified protocol. For non-HA, this is a direct connection to the ResourceManager address. When HA is enabled, the proxy handles the failover between the ResourceManagers as well.- Type Parameters:
T- Generic T.- Parameters:
configuration- configuration.protocol- protocol.instance- RMProxy instance.retryTime- retry Time.retryInterval- retry Interval.- Returns:
- RMProxy.
- Throws:
IOException- io error occur.
-
getProxy
@Private public <T> T getProxy(Configuration conf, Class<T> protocol, InetSocketAddress rmAddress) throws IOException Get a proxy to the RM at the specified address. To be used to create a RetryProxy.- Type Parameters:
T- Generic T.- Parameters:
conf- configuration.protocol- protocol.rmAddress- rmAddress.- Returns:
- RM proxy.
- Throws:
IOException- io error occur.
-
createRetryPolicy
@Private @VisibleForTesting public static org.apache.hadoop.io.retry.RetryPolicy createRetryPolicy(Configuration conf, boolean isHAEnabled) Fetch retry policy from Configuration.- Parameters:
conf- configuration.isHAEnabled- is HA enabled.- Returns:
- RetryPolicy.
-
createRetryPolicy
protected static org.apache.hadoop.io.retry.RetryPolicy createRetryPolicy(Configuration conf, long retryTime, long retryInterval, boolean isHAEnabled) Fetch retry policy from Configuration and create the retry policy with specified retryTime and retry interval.- Parameters:
conf- configuration.retryTime- retry time.retryInterval- retry interval.isHAEnabled- is HA enabled.- Returns:
- RetryPolicy.
-