P - Type of the protocol buffer implementationpublic abstract class YarnRpcAccessor<P> extends java.lang.Object implements InitializingBean, DisposableBean
| Constructor and Description |
|---|
YarnRpcAccessor(java.lang.Class<P> protocolClazz,
Configuration config)
Instantiates a new yarn rpc accessor with a protocol class
and Yarn configuration.
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
protected P |
createProxy()
Creates the proxy.
|
void |
destroy() |
<T,S extends P> |
execute(YarnRpcCallback<T,S> action)
Execute given action callback on the rpc proxy.
|
Configuration |
getConfiguration()
Gets the Yarn configuration.
|
P |
getProxy()
Gets the proxy handled by this accessor.
|
protected abstract java.net.InetSocketAddress |
getRpcAddress(Configuration configuration)
Gets the
InetSocketAddress where this accessor should connect. |
protected UserGroupInformation |
getUser()
Gets the
user used to
create the proxy. |
public YarnRpcAccessor(java.lang.Class<P> protocolClazz, Configuration config)
protocolClazz - the protocol clazzconfig - the yarn configurationpublic void afterPropertiesSet()
throws java.lang.Exception
afterPropertiesSet in interface InitializingBeanjava.lang.Exceptionpublic void destroy()
destroy in interface DisposableBeanpublic P getProxy()
public <T,S extends P> T execute(YarnRpcCallback<T,S> action) throws DataAccessException
T - the return typeS - the proxy typeaction - the actionDataAccessException - the data access exceptionpublic Configuration getConfiguration()
protected P createProxy() throws java.io.IOException
getUser() returns
a non null user, that
will be used to request the proxy with
a PrivilegedAction.java.io.IOException - if creation failsprotected UserGroupInformation getUser() throws java.io.IOException
user used to
create the proxy. Default implementation delegates into
UserGroupInformation.getCurrentUser().java.io.IOException - if login failscreateProxy()protected abstract java.net.InetSocketAddress getRpcAddress(Configuration configuration)
InetSocketAddress where this accessor should connect.configuration - the yarn configuration