|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.ipc.HBaseClient
public class HBaseClient
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.
HBaseServer
Nested Class Summary | |
---|---|
protected class |
HBaseClient.Call
A call waiting for a value. |
static class |
HBaseClient.CallTimeoutException
Client-side call timeout |
protected class |
HBaseClient.Connection
Thread that reads responses and notifies callers. |
protected static class |
HBaseClient.ConnectionId
This class holds the address and the user ticket. |
static class |
HBaseClient.FailedServerException
|
protected class |
HBaseClient.ParallelCall
Call implementation used for parallel calls. |
protected static class |
HBaseClient.ParallelResults
Result collector for parallel calls. |
Field Summary | |
---|---|
protected String |
clusterId
|
protected org.apache.hadoop.conf.Configuration |
conf
|
protected PoolMap<HBaseClient.ConnectionId,HBaseClient.Connection> |
connections
|
protected int |
counter
|
static int |
FAILED_SERVER_EXPIRY_DEFAULT
|
static String |
FAILED_SERVER_EXPIRY_KEY
|
protected org.apache.hadoop.hbase.ipc.HBaseClient.FailedServers |
failedServers
|
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)
Deprecated. Use call(Writable[], InetSocketAddress[], Class, User) instead |
org.apache.hadoop.io.Writable[] |
call(org.apache.hadoop.io.Writable[] params,
InetSocketAddress[] addresses,
Class<? extends VersionedProtocol> protocol,
User ticket)
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,
Class<? extends VersionedProtocol> protocol,
User ticket,
int rpcTimeout)
Make a call, passing param , to the IPC server running at
address which is servicing the protocol protocol,
with the ticket credentials, returning the value. |
org.apache.hadoop.io.Writable |
call(org.apache.hadoop.io.Writable param,
InetSocketAddress addr,
User ticket,
int rpcTimeout)
|
protected HBaseClient.Connection |
createConnection(HBaseClient.ConnectionId remoteId)
Creates a connection. |
protected HBaseClient.Connection |
getConnection(InetSocketAddress addr,
Class<? extends VersionedProtocol> protocol,
User ticket,
int rpcTimeout,
HBaseClient.Call call)
|
protected static int |
getPoolSize(org.apache.hadoop.conf.Configuration config)
Return the pool size specified in the configuration, which is applicable only if the pool type is PoolMap.PoolType.RoundRobin . |
protected static PoolMap.PoolType |
getPoolType(org.apache.hadoop.conf.Configuration config)
Return the pool type specified in the configuration, which must be set to either PoolMap.PoolType.RoundRobin or PoolMap.PoolType.ThreadLocal ,
otherwise default to the former. |
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. |
protected IOException |
wrapException(InetSocketAddress addr,
IOException exception)
Take an IOException and the address we were trying to connect to and return an IOException with the input exception as the cause. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final PoolMap<HBaseClient.ConnectionId,HBaseClient.Connection> connections
protected final Class<? extends org.apache.hadoop.io.Writable> valueClass
protected int counter
protected final AtomicBoolean running
protected final org.apache.hadoop.conf.Configuration conf
protected final int maxIdleTime
protected final int maxRetries
protected final long failureSleep
protected final boolean tcpNoDelay
protected final boolean tcpKeepAlive
protected int pingInterval
protected int socketTimeout
protected org.apache.hadoop.hbase.ipc.HBaseClient.FailedServers failedServers
protected final SocketFactory socketFactory
protected String clusterId
public static final String FAILED_SERVER_EXPIRY_KEY
public static final int FAILED_SERVER_EXPIRY_DEFAULT
Constructor Detail |
---|
public HBaseClient(Class<? extends org.apache.hadoop.io.Writable> valueClass, org.apache.hadoop.conf.Configuration conf, SocketFactory factory)
Writable
class.
valueClass
- value classconf
- configurationfactory
- socket factorypublic HBaseClient(Class<? extends org.apache.hadoop.io.Writable> valueClass, org.apache.hadoop.conf.Configuration conf)
valueClass
- value classconf
- configurationMethod Detail |
---|
public static void setPingInterval(org.apache.hadoop.conf.Configuration conf, int pingInterval)
conf
- ConfigurationpingInterval
- the ping intervalpublic static void setSocketTimeout(org.apache.hadoop.conf.Configuration conf, int socketTimeout)
conf
- ConfigurationsocketTimeout
- the socket timeoutprotected HBaseClient.Connection createConnection(HBaseClient.ConnectionId remoteId) throws IOException
remoteId
- - the ConnectionId to use for the connection creation.
IOException
protected static PoolMap.PoolType getPoolType(org.apache.hadoop.conf.Configuration config)
PoolMap.PoolType.RoundRobin
or PoolMap.PoolType.ThreadLocal
,
otherwise default to the former.
For applications with many user threads, use a small round-robin pool. For
applications with few user threads, you may want to try using a
thread-local pool. In any case, the number of HBaseClient
instances
should not exceed the operating system's hard limit on the number of
connections.
config
- configuration
PoolMap.PoolType.RoundRobin
or
PoolMap.PoolType.ThreadLocal
protected static int getPoolSize(org.apache.hadoop.conf.Configuration config)
PoolMap.PoolType.RoundRobin
.
config
-
public void stop()
public org.apache.hadoop.io.Writable call(org.apache.hadoop.io.Writable param, InetSocketAddress address) throws IOException, InterruptedException
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.
param
- writable parameteraddress
- network address
IOException
- e
InterruptedException
public org.apache.hadoop.io.Writable call(org.apache.hadoop.io.Writable param, InetSocketAddress addr, User ticket, int rpcTimeout) throws IOException, InterruptedException
IOException
InterruptedException
public org.apache.hadoop.io.Writable call(org.apache.hadoop.io.Writable param, InetSocketAddress addr, Class<? extends VersionedProtocol> protocol, User ticket, int rpcTimeout) throws InterruptedException, IOException
param
, to the IPC server running at
address
which is servicing the protocol
protocol,
with the ticket
credentials, returning the value.
Throws exceptions if there are network problems or if the remote code
threw an exception.
InterruptedException
IOException
protected IOException wrapException(InetSocketAddress addr, IOException exception)
addr
- target addressexception
- the relevant exception
@Deprecated public org.apache.hadoop.io.Writable[] call(org.apache.hadoop.io.Writable[] params, InetSocketAddress[] addresses) throws IOException, InterruptedException
call(Writable[], InetSocketAddress[], Class, User)
instead
params
- writable parametersaddresses
- socket addresses
IOException
- e
InterruptedException
public org.apache.hadoop.io.Writable[] call(org.apache.hadoop.io.Writable[] params, InetSocketAddress[] addresses, Class<? extends VersionedProtocol> protocol, User ticket) throws IOException, InterruptedException
IOException
InterruptedException
protected HBaseClient.Connection getConnection(InetSocketAddress addr, Class<? extends VersionedProtocol> protocol, User ticket, int rpcTimeout, HBaseClient.Call call) throws IOException, InterruptedException
IOException
InterruptedException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |