org.apache.hadoop.hbase.ipc
Class HBaseClient

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

public class HBaseClient
extends Object

A client for an IPC service. IPC calls take a single Writable as a parameter, and return a Writable as their value. A service runs on a port and is defined by a parameter class and a value class.

This is the org.apache.hadoop.ipc.Client renamed as HBaseClient and moved into this package so can access package-private methods.

See Also:
HBaseServer

Field Summary
protected  org.apache.hadoop.conf.Configuration conf
           
protected  Hashtable<org.apache.hadoop.hbase.ipc.HBaseClient.ConnectionId,org.apache.hadoop.hbase.ipc.HBaseClient.Connection> connections
           
protected  int counter
           
protected  long failureSleep
           
protected  int maxIdleTime
           
protected  int maxRetries
           
protected  int pingInterval
           
protected  AtomicBoolean running
           
protected  SocketFactory socketFactory
           
protected  int socketTimeout
           
protected  boolean tcpKeepAlive
           
protected  boolean tcpNoDelay
           
protected  Class<? extends org.apache.hadoop.io.Writable> valueClass
           
 
Constructor Summary
HBaseClient(Class<? extends org.apache.hadoop.io.Writable> valueClass, org.apache.hadoop.conf.Configuration conf)
          Construct an IPC client with the default SocketFactory
HBaseClient(Class<? extends org.apache.hadoop.io.Writable> valueClass, org.apache.hadoop.conf.Configuration conf, SocketFactory factory)
          Construct an IPC client whose values are of the given Writable class.
 
Method Summary
 org.apache.hadoop.io.Writable[] call(org.apache.hadoop.io.Writable[] params, InetSocketAddress[] addresses)
          Makes a set of calls in parallel.
 org.apache.hadoop.io.Writable call(org.apache.hadoop.io.Writable param, InetSocketAddress address)
          Make a call, passing param, to the IPC server running at address, returning the value.
 org.apache.hadoop.io.Writable call(org.apache.hadoop.io.Writable param, InetSocketAddress addr, org.apache.hadoop.security.UserGroupInformation ticket, int rpcTimeout)
           
static void setPingInterval(org.apache.hadoop.conf.Configuration conf, int pingInterval)
          set the ping interval value in configuration
static void setSocketTimeout(org.apache.hadoop.conf.Configuration conf, int socketTimeout)
          Set the socket timeout
 void stop()
          Stop all threads related to this client.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connections

protected final Hashtable<org.apache.hadoop.hbase.ipc.HBaseClient.ConnectionId,org.apache.hadoop.hbase.ipc.HBaseClient.Connection> connections

valueClass

protected final Class<? extends org.apache.hadoop.io.Writable> valueClass

counter

protected int counter

running

protected final AtomicBoolean running

conf

protected final org.apache.hadoop.conf.Configuration conf

maxIdleTime

protected final int maxIdleTime

maxRetries

protected final int maxRetries

failureSleep

protected final long failureSleep

tcpNoDelay

protected final boolean tcpNoDelay

tcpKeepAlive

protected final boolean tcpKeepAlive

pingInterval

protected int pingInterval

socketTimeout

protected int socketTimeout

socketFactory

protected final SocketFactory socketFactory
Constructor Detail

HBaseClient

public HBaseClient(Class<? extends org.apache.hadoop.io.Writable> valueClass,
                   org.apache.hadoop.conf.Configuration conf,
                   SocketFactory factory)
Construct an IPC client whose values are of the given Writable class.

Parameters:
valueClass - value class
conf - configuration
factory - socket factory

HBaseClient

public HBaseClient(Class<? extends org.apache.hadoop.io.Writable> valueClass,
                   org.apache.hadoop.conf.Configuration conf)
Construct an IPC client with the default SocketFactory

Parameters:
valueClass - value class
conf - configuration
Method Detail

setPingInterval

public static void setPingInterval(org.apache.hadoop.conf.Configuration conf,
                                   int pingInterval)
set the ping interval value in configuration

Parameters:
conf - Configuration
pingInterval - the ping interval

setSocketTimeout

public static void setSocketTimeout(org.apache.hadoop.conf.Configuration conf,
                                    int socketTimeout)
Set the socket timeout

Parameters:
conf - Configuration
socketTimeout - the socket timeout

stop

public void stop()
Stop all threads related to this client. No further calls may be made using this client.


call

public org.apache.hadoop.io.Writable call(org.apache.hadoop.io.Writable param,
                                          InetSocketAddress address)
                                   throws IOException
Make a call, passing param, to the IPC server running at address, returning the value. Throws exceptions if there are network problems or if the remote code threw an exception.

Parameters:
param - writable parameter
address - network address
Returns:
Writable
Throws:
IOException - e

call

public org.apache.hadoop.io.Writable call(org.apache.hadoop.io.Writable param,
                                          InetSocketAddress addr,
                                          org.apache.hadoop.security.UserGroupInformation ticket,
                                          int rpcTimeout)
                                   throws IOException
Throws:
IOException

call

public org.apache.hadoop.io.Writable[] call(org.apache.hadoop.io.Writable[] params,
                                            InetSocketAddress[] addresses)
                                     throws IOException
Makes a set of calls in parallel. Each parameter is sent to the corresponding address. When all values are available, or have timed out or errored, the collected results are returned in an array. The array contains nulls for calls that timed out or errored.

Parameters:
params - writable parameters
addresses - socket addresses
Returns:
Writable[]
Throws:
IOException - e


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