## org.apache.hadoop.ipc
Class RPC

    java.lang.Object
      org.apache.hadoop.ipc.RPC

    public class RPC

extends Object

A simple RPC mechanism. A protocol is a Java interface. All parameters and return types must be one of:

- a primitive type, `boolean`, `byte`, `char`, `short`, `int`, `long`, `float`, `double`, or `void`; or
- a `String`; or
- a `Writable`; or
- an array of the above types

All methods in the protocol should throw only IOException. No field data of the protocol instance is transmitted.

Nested Class Summary
`static class` `RPC.Server` An RPC Server.
`static class` `RPC.VersionMismatch` A version mismatch for the RPC protocol.

Method Summary
`static Object[]` `call(Method method, Object[][] params, InetSocketAddress[] addrs, Configuration conf)` Deprecated. Use `call(Method, Object[][], InetSocketAddress[], UserGroupInformation, Configuration)` instead
`static Object[]` `call(Method method, Object[][] params, InetSocketAddress[] addrs, UserGroupInformation ticket, Configuration conf)` Expert: Make multiple, parallel calls to a set of servers.
`static VersionedProtocol` `getProxy(Class<? extends VersionedProtocol> protocol, long clientVersion, InetSocketAddress addr, Configuration conf)` Construct a client-side proxy object with the default SocketFactory
`static VersionedProtocol` `getProxy(Class<? extends VersionedProtocol> protocol, long clientVersion, InetSocketAddress addr, Configuration conf, int rpcTimeout)`
`static VersionedProtocol` `getProxy(Class<? extends VersionedProtocol> 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 VersionedProtocol` `getProxy(Class<? extends VersionedProtocol> protocol, long clientVersion, InetSocketAddress addr, Configuration conf, SocketFactory factory, int rpcTimeout)` Construct a client-side proxy object that implements the named protocol, talking to a server at the named address.
`static VersionedProtocol` `getProxy(Class<? extends VersionedProtocol> 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 VersionedProtocol` `getProxy(Class<? extends VersionedProtocol> protocol, long clientVersion, InetSocketAddress addr, UserGroupInformation ticket, Configuration conf, SocketFactory factory, int rpcTimeout)` Construct a client-side proxy object that implements the named protocol, talking to a server at the named address.
`static RPC.Server` `getServer(Object instance, String bindAddress, int port, Configuration conf)` Construct a server for a protocol implementation instance listening on a port and address.
`static RPC.Server` `getServer(Object instance, String bindAddress, int port, int numHandlers, boolean verbose, Configuration conf)` Construct a server for a protocol implementation instance listening on a port and address.
`static RPC.Server` `getServer(Object instance, String bindAddress, int port, int numHandlers, boolean verbose, Configuration conf, SecretManager<? extends TokenIdentifier> secretManager)` Construct a server for a protocol implementation instance listening on a port and address, with a secret manager.
`static void` `stopProxy(VersionedProtocol proxy)` Stop this proxy and release its invoker's resource
`static VersionedProtocol` `waitForProxy(Class<? extends VersionedProtocol> protocol, long clientVersion, InetSocketAddress addr, Configuration conf)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### waitForProxy

    public static VersionedProtocol waitForProxy(Class<? extends VersionedProtocol> protocol,
                                                 long clientVersion,
                                                 InetSocketAddress addr,
                                                 Configuration conf)
                                          throws IOException

  Throws:
    `IOException`

### getProxy

    public static VersionedProtocol getProxy(Class<? extends VersionedProtocol> protocol,
                                             long clientVersion,
                                             InetSocketAddress addr,
                                             Configuration conf,
                                             SocketFactory factory)
                                      throws IOException

  Construct a client-side proxy object that implements the named protocol, talking to a server at the named address.

  Throws:
    `IOException`

### getProxy

    public static VersionedProtocol getProxy(Class<? extends VersionedProtocol> protocol,
                                             long clientVersion,
                                             InetSocketAddress addr,
                                             Configuration conf,
                                             SocketFactory factory,
                                             int rpcTimeout)
                                      throws IOException

  Construct a client-side proxy object that implements the named protocol, talking to a server at the named address.

  Throws:
    `IOException`

### getProxy

    public static VersionedProtocol getProxy(Class<? extends VersionedProtocol> protocol,
                                             long clientVersion,
                                             InetSocketAddress addr,
                                             UserGroupInformation ticket,
                                             Configuration conf,
                                             SocketFactory factory)
                                      throws IOException

  Construct a client-side proxy object that implements the named protocol, talking to a server at the named address.

  Throws:
    `IOException`

### getProxy

    public static VersionedProtocol getProxy(Class<? extends VersionedProtocol> protocol,
                                             long clientVersion,
                                             InetSocketAddress addr,
                                             UserGroupInformation ticket,
                                             Configuration conf,
                                             SocketFactory factory,
                                             int rpcTimeout)
                                      throws IOException

  Construct a client-side proxy object that implements the named protocol, talking to a server at the named address.

  Throws:
    `IOException`

### getProxy

    public static VersionedProtocol getProxy(Class<? extends VersionedProtocol> protocol,
                                             long clientVersion,
                                             InetSocketAddress addr,
                                             Configuration conf)
                                      throws IOException

  Construct a client-side proxy object with the default SocketFactory

  Parameters:
    `protocol` -
    `clientVersion` -
    `addr` -
    `conf` -
  Returns:
    a proxy instance
  Throws:
    `IOException`

### getProxy

    public static VersionedProtocol getProxy(Class<? extends VersionedProtocol> protocol,
                                             long clientVersion,
                                             InetSocketAddress addr,
                                             Configuration conf,
                                             int rpcTimeout)
                                      throws IOException

  Throws:
    `IOException`

### stopProxy

    public static void stopProxy(VersionedProtocol proxy)

  Stop this proxy and release its invoker's resource

  Parameters:
    `proxy` - the proxy to be stopped

### call

    public static Object[] call(Method method,
                                Object[][] params,
                                InetSocketAddress[] addrs,
                                Configuration conf)
                         throws IOException,
                                InterruptedException

  Deprecated. Use `call(Method, Object[][], InetSocketAddress[], UserGroupInformation, Configuration)` instead

  Expert: Make multiple, parallel calls to a set of servers.

  Throws:
    `IOException`
    `InterruptedException`

### call

    public static Object[] call(Method method,
                                Object[][] params,
                                InetSocketAddress[] addrs,
                                UserGroupInformation ticket,
                                Configuration conf)
                         throws IOException,
                                InterruptedException

  Expert: Make multiple, parallel calls to a set of servers.

  Throws:
    `IOException`
    `InterruptedException`

### getServer

    public static RPC.Server getServer(Object instance,
                                       String bindAddress,
                                       int port,
                                       Configuration conf)
                                throws IOException

  Construct a server for a protocol implementation instance listening on a port and address.

  Throws:
    `IOException`

### getServer

    public static RPC.Server getServer(Object instance,
                                       String bindAddress,
                                       int port,
                                       int numHandlers,
                                       boolean verbose,
                                       Configuration conf)
                                throws IOException

  Construct a server for a protocol implementation instance listening on a port and address.

  Throws:
    `IOException`

### getServer

    public static RPC.Server getServer(Object instance,
                                       String bindAddress,
                                       int port,
                                       int numHandlers,
                                       boolean verbose,
                                       Configuration conf,
                                       SecretManager<? extends TokenIdentifier> secretManager)
                                throws IOException

  Construct a server for a protocol implementation instance listening on a port and address, with a secret manager.

  Throws:
    `IOException`

Copyright © 2009 The Apache Software Foundation