org.apache.hadoop.hbase.ipc
Class HBaseRPC

java.lang.Object
  extended by org.apache.hadoop.hbase.ipc.HBaseRPC

public class HBaseRPC
extends Object

A simple RPC mechanism. This is a local hbase copy of the hadoop RPC so we can do things like address HADOOP-414 for hbase-only and try other hbase-specific optimizations like using our own version of ObjectWritable. Class has been renamed to avoid confusing it w/ hadoop versions.

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

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


Nested Class Summary
static class HBaseRPC.Invocation
          A method invocation, including the method name and its parameters.
static class HBaseRPC.Server
          An RPC Server.
static class HBaseRPC.VersionMismatch
          A version mismatch for the RPC protocol.
 
Field Summary
protected static org.apache.hadoop.hbase.ipc.HBaseRPC.ClientCache CLIENTS
           
protected static org.apache.commons.logging.Log LOG
           
 
Method Summary
static Object[] call(Method method, Object[][] params, InetSocketAddress[] addrs, org.apache.hadoop.conf.Configuration conf)
          Expert: Make multiple, parallel calls to a set of servers.
static org.apache.hadoop.ipc.VersionedProtocol getProxy(Class<?> protocol, long clientVersion, InetSocketAddress addr, org.apache.hadoop.conf.Configuration conf, int rpcTimeout)
          Construct a client-side proxy object with the default SocketFactory
static org.apache.hadoop.ipc.VersionedProtocol getProxy(Class<?> protocol, long clientVersion, InetSocketAddress addr, org.apache.hadoop.conf.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 org.apache.hadoop.ipc.VersionedProtocol getProxy(Class<?> protocol, long clientVersion, InetSocketAddress addr, org.apache.hadoop.security.UserGroupInformation ticket, org.apache.hadoop.conf.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 HBaseRPC.Server getServer(Object instance, Class<?>[] ifaces, String bindAddress, int port, int numHandlers, int metaHandlerCount, boolean verbose, org.apache.hadoop.conf.Configuration conf, int highPriorityLevel)
          Construct a server for a protocol implementation instance listening on a port and address.
protected static void log(String value)
           
static void stopProxy(org.apache.hadoop.ipc.VersionedProtocol proxy)
          Stop this proxy and release its invoker's resource
static org.apache.hadoop.ipc.VersionedProtocol waitForProxy(Class protocol, long clientVersion, InetSocketAddress addr, org.apache.hadoop.conf.Configuration conf, int maxAttempts, int rpcTimeout, long timeout)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static final org.apache.commons.logging.Log LOG

CLIENTS

protected static final org.apache.hadoop.hbase.ipc.HBaseRPC.ClientCache CLIENTS
Method Detail

waitForProxy

public static org.apache.hadoop.ipc.VersionedProtocol waitForProxy(Class protocol,
                                                                   long clientVersion,
                                                                   InetSocketAddress addr,
                                                                   org.apache.hadoop.conf.Configuration conf,
                                                                   int maxAttempts,
                                                                   int rpcTimeout,
                                                                   long timeout)
                                                            throws IOException
Parameters:
protocol - protocol interface
clientVersion - which client version we expect
addr - address of remote service
conf - configuration
maxAttempts - max attempts
rpcTimeout - timeout for each RPC
timeout - timeout in milliseconds
Returns:
proxy
Throws:
IOException - e

getProxy

public static org.apache.hadoop.ipc.VersionedProtocol getProxy(Class<?> protocol,
                                                               long clientVersion,
                                                               InetSocketAddress addr,
                                                               org.apache.hadoop.conf.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.

Parameters:
protocol - interface
clientVersion - version we are expecting
addr - remote address
conf - configuration
factory - socket factory
rpcTimeout - timeout for each RPC
Returns:
proxy
Throws:
IOException - e

getProxy

public static org.apache.hadoop.ipc.VersionedProtocol getProxy(Class<?> protocol,
                                                               long clientVersion,
                                                               InetSocketAddress addr,
                                                               org.apache.hadoop.security.UserGroupInformation ticket,
                                                               org.apache.hadoop.conf.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.

Parameters:
protocol - interface
clientVersion - version we are expecting
addr - remote address
ticket - ticket
conf - configuration
factory - socket factory
rpcTimeout - timeout for each RPC
Returns:
proxy
Throws:
IOException - e

getProxy

public static org.apache.hadoop.ipc.VersionedProtocol getProxy(Class<?> protocol,
                                                               long clientVersion,
                                                               InetSocketAddress addr,
                                                               org.apache.hadoop.conf.Configuration conf,
                                                               int rpcTimeout)
                                                        throws IOException
Construct a client-side proxy object with the default SocketFactory

Parameters:
protocol - interface
clientVersion - version we are expecting
addr - remote address
conf - configuration
rpcTimeout - timeout for each RPC
Returns:
a proxy instance
Throws:
IOException - e

stopProxy

public static void stopProxy(org.apache.hadoop.ipc.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,
                            org.apache.hadoop.conf.Configuration conf)
                     throws IOException
Expert: Make multiple, parallel calls to a set of servers.

Parameters:
method - method to invoke
params - array of parameters
addrs - array of addresses
conf - configuration
Returns:
values
Throws:
IOException - e

getServer

public static HBaseRPC.Server getServer(Object instance,
                                        Class<?>[] ifaces,
                                        String bindAddress,
                                        int port,
                                        int numHandlers,
                                        int metaHandlerCount,
                                        boolean verbose,
                                        org.apache.hadoop.conf.Configuration conf,
                                        int highPriorityLevel)
                                 throws IOException
Construct a server for a protocol implementation instance listening on a port and address.

Parameters:
instance - instance
bindAddress - bind address
port - port to bind to
numHandlers - number of handlers to start
verbose - verbose flag
conf - configuration
Returns:
Server
Throws:
IOException - e

log

protected static void log(String value)


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.