public class RPC extends Object
Modifier and Type | Class and Description |
---|---|
static class |
RPC.Builder
Class to construct instances of RPC server with specific options.
|
static class |
RPC.RpcKind |
static class |
RPC.Server
An RPC Server.
|
static class |
RPC.VersionMismatch
A version mismatch for the RPC protocol.
|
Modifier and Type | Method and Description |
---|---|
static Client.ConnectionId |
getConnectionIdForProxy(Object proxy)
Return the connection ID of the given object.
|
static String |
getProtocolName(Class<?> protocol)
Get the protocol name.
|
static <T> ProtocolProxy<T> |
getProtocolProxy(Class<T> protocol,
long clientVersion,
InetSocketAddress addr,
Configuration conf)
Get a protocol proxy that contains a proxy connection to a remote server
and a set of methods that are supported by the server
|
static <T> ProtocolProxy<T> |
getProtocolProxy(Class<T> protocol,
long clientVersion,
InetSocketAddress addr,
Configuration conf,
SocketFactory factory)
Get a protocol proxy that contains a proxy connection to a remote server
and a set of methods that are supported by the server
|
static <T> ProtocolProxy<T> |
getProtocolProxy(Class<T> protocol,
long clientVersion,
InetSocketAddress addr,
UserGroupInformation ticket,
Configuration conf,
SocketFactory factory)
Get a protocol proxy that contains a proxy connection to a remote server
and a set of methods that are supported by the server
|
static <T> ProtocolProxy<T> |
getProtocolProxy(Class<T> protocol,
long clientVersion,
InetSocketAddress addr,
UserGroupInformation ticket,
Configuration conf,
SocketFactory factory,
int rpcTimeout,
RetryPolicy connectionRetryPolicy)
Get a protocol proxy that contains a proxy connection to a remote server
and a set of methods that are supported by the server
|
static long |
getProtocolVersion(Class<?> protocol)
Get the protocol version from protocol class.
|
static <T> T |
getProxy(Class<T> protocol,
long clientVersion,
InetSocketAddress addr,
Configuration conf)
Construct a client-side proxy object with the default SocketFactory
|
static <T> T |
getProxy(Class<T> protocol,
long clientVersion,
InetSocketAddress addr,
Configuration conf,
SocketFactory factory)
Construct a client-side proxy object that implements the named protocol,
talking to a server at the named address.
|
static <T> T |
getProxy(Class<T> protocol,
long clientVersion,
InetSocketAddress addr,
UserGroupInformation ticket,
Configuration conf,
SocketFactory factory)
Construct a client-side proxy object that implements the named protocol,
talking to a server at the named address.
|
static <T> T |
getProxy(Class<T> protocol,
long clientVersion,
InetSocketAddress addr,
UserGroupInformation ticket,
Configuration conf,
SocketFactory factory,
int rpcTimeout)
Construct a client-side proxy that implements the named protocol,
talking to a server at the named address.
|
static InetSocketAddress |
getServerAddress(Object proxy)
Returns the server address for a given proxy.
|
static void |
setProtocolEngine(Configuration conf,
Class<?> protocol,
Class<?> engine)
Set a protocol to use a non-default RpcEngine.
|
static void |
stopProxy(Object proxy)
Stop the proxy.
|
static <T> ProtocolProxy<T> |
waitForProtocolProxy(Class<T> protocol,
long clientVersion,
InetSocketAddress addr,
Configuration conf)
Get a protocol proxy that contains a proxy connection to a remote server
and a set of methods that are supported by the server
|
static <T> ProtocolProxy<T> |
waitForProtocolProxy(Class<T> protocol,
long clientVersion,
InetSocketAddress addr,
Configuration conf,
int rpcTimeout,
RetryPolicy connectionRetryPolicy,
long timeout)
Get a protocol proxy that contains a proxy connection to a remote server
and a set of methods that are supported by the server
|
static <T> ProtocolProxy<T> |
waitForProtocolProxy(Class<T> protocol,
long clientVersion,
InetSocketAddress addr,
Configuration conf,
long connTimeout)
Get a protocol proxy that contains a proxy connection to a remote server
and a set of methods that are supported by the server
|
static <T> T |
waitForProxy(Class<T> protocol,
long clientVersion,
InetSocketAddress addr,
Configuration conf)
Get a proxy connection to a remote server
|
static <T> T |
waitForProxy(Class<T> protocol,
long clientVersion,
InetSocketAddress addr,
Configuration conf,
int rpcTimeout,
long timeout)
Get a proxy connection to a remote server
|
static <T> T |
waitForProxy(Class<T> protocol,
long clientVersion,
InetSocketAddress addr,
Configuration conf,
long connTimeout)
Get a proxy connection to a remote server
|
public static String getProtocolName(Class<?> protocol)
public static long getProtocolVersion(Class<?> protocol)
public static void setProtocolEngine(Configuration conf, Class<?> protocol, Class<?> engine)
conf
- configuration to useprotocol
- the protocol interfaceengine
- the RpcEngine implpublic static <T> T waitForProxy(Class<T> protocol, long clientVersion, InetSocketAddress addr, Configuration conf) throws IOException
protocol
- protocol classclientVersion
- client versionaddr
- remote addressconf
- configuration to useIOException
- if the far end through a RemoteExceptionpublic static <T> ProtocolProxy<T> waitForProtocolProxy(Class<T> protocol, long clientVersion, InetSocketAddress addr, Configuration conf) throws IOException
protocol
- protocol classclientVersion
- client versionaddr
- remote addressconf
- configuration to useIOException
- if the far end through a RemoteExceptionpublic static <T> T waitForProxy(Class<T> protocol, long clientVersion, InetSocketAddress addr, Configuration conf, long connTimeout) throws IOException
protocol
- protocol classclientVersion
- client versionaddr
- remote addressconf
- configuration to useconnTimeout
- time in milliseconds before giving upIOException
- if the far end through a RemoteExceptionpublic static <T> ProtocolProxy<T> waitForProtocolProxy(Class<T> protocol, long clientVersion, InetSocketAddress addr, Configuration conf, long connTimeout) throws IOException
protocol
- protocol classclientVersion
- client versionaddr
- remote addressconf
- configuration to useconnTimeout
- time in milliseconds before giving upIOException
- if the far end through a RemoteExceptionpublic static <T> T waitForProxy(Class<T> protocol, long clientVersion, InetSocketAddress addr, Configuration conf, int rpcTimeout, long timeout) throws IOException
protocol
- protocol classclientVersion
- client versionaddr
- remote addressconf
- configuration to userpcTimeout
- timeout for each RPCtimeout
- time in milliseconds before giving upIOException
- if the far end through a RemoteExceptionpublic static <T> ProtocolProxy<T> waitForProtocolProxy(Class<T> protocol, long clientVersion, InetSocketAddress addr, Configuration conf, int rpcTimeout, RetryPolicy connectionRetryPolicy, long timeout) throws IOException
protocol
- protocol classclientVersion
- client versionaddr
- remote addressconf
- configuration to userpcTimeout
- timeout for each RPCtimeout
- time in milliseconds before giving upIOException
- if the far end through a RemoteExceptionpublic static <T> T getProxy(Class<T> protocol, long clientVersion, InetSocketAddress addr, Configuration conf, SocketFactory factory) throws IOException
T
- IOException
public static <T> ProtocolProxy<T> getProtocolProxy(Class<T> protocol, long clientVersion, InetSocketAddress addr, Configuration conf, SocketFactory factory) throws IOException
protocol
- protocol classclientVersion
- client versionaddr
- remote addressconf
- configuration to usefactory
- socket factoryIOException
- if the far end through a RemoteExceptionpublic static <T> T getProxy(Class<T> protocol, long clientVersion, InetSocketAddress addr, UserGroupInformation ticket, Configuration conf, SocketFactory factory) throws IOException
T
- IOException
public static <T> ProtocolProxy<T> getProtocolProxy(Class<T> protocol, long clientVersion, InetSocketAddress addr, UserGroupInformation ticket, Configuration conf, SocketFactory factory) throws IOException
protocol
- protocol classclientVersion
- client versionaddr
- remote addressticket
- user group informationconf
- configuration to usefactory
- socket factoryIOException
- if the far end through a RemoteExceptionpublic static <T> T getProxy(Class<T> protocol, long clientVersion, InetSocketAddress addr, UserGroupInformation ticket, Configuration conf, SocketFactory factory, int rpcTimeout) throws IOException
T
- protocol
- protocolclientVersion
- client's versionaddr
- server addressticket
- security ticketconf
- configurationfactory
- socket factoryrpcTimeout
- max time for each rpc; 0 means no timeoutIOException
- if any error occurspublic static <T> ProtocolProxy<T> getProtocolProxy(Class<T> protocol, long clientVersion, InetSocketAddress addr, UserGroupInformation ticket, Configuration conf, SocketFactory factory, int rpcTimeout, RetryPolicy connectionRetryPolicy) throws IOException
protocol
- protocolclientVersion
- client's versionaddr
- server addressticket
- security ticketconf
- configurationfactory
- socket factoryrpcTimeout
- max time for each rpc; 0 means no timeoutIOException
- if any error occurspublic static <T> T getProxy(Class<T> protocol, long clientVersion, InetSocketAddress addr, Configuration conf) throws IOException
T
- protocol
- clientVersion
- addr
- conf
- IOException
public static InetSocketAddress getServerAddress(Object proxy)
public static Client.ConnectionId getConnectionIdForProxy(Object proxy)
proxy
- the proxy object to get the connection ID of.public static <T> ProtocolProxy<T> getProtocolProxy(Class<T> protocol, long clientVersion, InetSocketAddress addr, Configuration conf) throws IOException
protocol
- clientVersion
- addr
- conf
- IOException
public static void stopProxy(Object proxy)
Closeable
or must have
associated RpcInvocationHandler
.proxy
- the RPC proxy object to be stoppedHadoopIllegalArgumentException
- if the proxy does not implement Closeable
interface or
does not have closeable InvocationHandler
Copyright © 2013 Apache Software Foundation. All rights reserved.