@InterfaceAudience.Private public class RpcClient extends Object
See HBaseServer
Modifier and Type | Class and Description |
---|---|
static class |
RpcClient.BlockingRpcChannelImplementation
Blocking rpc channel that goes via hbase rpc.
|
protected class |
RpcClient.Call
A call waiting for a value.
|
static class |
RpcClient.CallTimeoutException
Client-side call timeout
|
protected class |
RpcClient.Connection
Thread that reads responses and notifies callers.
|
protected static class |
RpcClient.ConnectionId
This class holds the address and the user ticket, etc.
|
static class |
RpcClient.FailedServerException
Indicates that we're trying to connect to a already known as dead server.
|
Constructor and Description |
---|
RpcClient(org.apache.hadoop.conf.Configuration conf,
String clusterId)
Construct an IPC client for the cluster
clusterId with the default SocketFactory |
RpcClient(org.apache.hadoop.conf.Configuration conf,
String clusterId,
SocketAddress localAddr)
Construct an IPC client for the cluster
clusterId with the default SocketFactory |
Modifier and Type | Method and Description |
---|---|
void |
cancelConnections(String hostname,
int port)
Interrupt the connections to the given ip:port server.
|
BlockingRpcChannel |
createBlockingRpcChannel(ServerName sn,
User ticket,
int defaultOperationTimeout)
Creates a "channel" that can be used by a blocking protobuf service.
|
protected RpcClient.Connection |
createConnection(RpcClient.ConnectionId remoteId,
Codec codec,
org.apache.hadoop.io.compress.CompressionCodec compressor)
Creates a connection.
|
protected RpcClient.Connection |
getConnection(User ticket,
RpcClient.Call call,
InetSocketAddress addr,
Codec codec,
org.apache.hadoop.io.compress.CompressionCodec compressor)
Get a connection from the pool, or create a new one and add it to the
pool.
|
static String |
getDefaultCodec(org.apache.hadoop.conf.Configuration c) |
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. |
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.
|
public static final org.apache.commons.logging.Log LOG
protected final PoolMap<RpcClient.ConnectionId,RpcClient.Connection> connections
protected final AtomicInteger callIdCnt
protected final AtomicBoolean running
protected final org.apache.hadoop.conf.Configuration conf
protected final int minIdleTimeBeforeClose
protected final int maxRetries
protected final long failureSleep
protected final boolean tcpNoDelay
protected final boolean tcpKeepAlive
protected final org.apache.hadoop.hbase.ipc.RpcClient.FailedServers failedServers
protected final SocketFactory socketFactory
protected String clusterId
protected final SocketAddress localAddr
public static final String FAILED_SERVER_EXPIRY_KEY
public static final int FAILED_SERVER_EXPIRY_DEFAULT
public static final String IDLE_TIME
public static final String IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_KEY
public static final boolean IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_DEFAULT
public static final String SPECIFIC_WRITE_THREAD
protected static final Map<AuthenticationProtos.TokenIdentifier.Kind,org.apache.hadoop.security.token.TokenSelector<? extends org.apache.hadoop.security.token.TokenIdentifier>> tokenHandlers
public RpcClient(org.apache.hadoop.conf.Configuration conf, String clusterId)
clusterId
with the default SocketFactoryconf
- configurationclusterId
- the cluster idpublic RpcClient(org.apache.hadoop.conf.Configuration conf, String clusterId, SocketAddress localAddr)
clusterId
with the default SocketFactoryconf
- configurationclusterId
- the cluster idlocalAddr
- client socket bind address.protected RpcClient.Connection createConnection(RpcClient.ConnectionId remoteId, Codec codec, org.apache.hadoop.io.compress.CompressionCodec compressor) throws IOException
remoteId
- - the ConnectionId to use for the connection creation.IOException
public static String getDefaultCodec(org.apache.hadoop.conf.Configuration c)
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 RpcClient
instances
should not exceed the operating system's hard limit on the number of
connections.config
- configurationPoolMap.PoolType.RoundRobin
or
PoolMap.PoolType.ThreadLocal
protected static int getPoolSize(org.apache.hadoop.conf.Configuration config)
PoolMap.PoolType.RoundRobin
.config
- configurationpublic void stop()
protected IOException wrapException(InetSocketAddress addr, IOException exception)
addr
- target addressexception
- the relevant exceptionpublic void cancelConnections(String hostname, int port)
protected RpcClient.Connection getConnection(User ticket, RpcClient.Call call, InetSocketAddress addr, Codec codec, org.apache.hadoop.io.compress.CompressionCodec compressor) throws IOException
IOException
public BlockingRpcChannel createBlockingRpcChannel(ServerName sn, User ticket, int defaultOperationTimeout)
Copyright © 2014 The Apache Software Foundation. All Rights Reserved.