|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.ipc.RpcClient
@InterfaceAudience.Private public class RpcClient
Does RPC against a cluster. Manages connections per regionserver in the cluster.
See HBaseServer
Nested Class Summary | |
---|---|
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
|
Constructor Summary | |
---|---|
RpcClient(org.apache.hadoop.conf.Configuration conf,
String clusterId)
Helper method for tests only. |
|
RpcClient(org.apache.hadoop.conf.Configuration conf,
String clusterId,
MetricsConnection metrics)
Construct an IPC client for the cluster clusterId with the default SocketFactory |
|
RpcClient(org.apache.hadoop.conf.Configuration conf,
String clusterId,
SocketAddress localAddr,
MetricsConnection metrics)
Construct an IPC client for the cluster clusterId with the default SocketFactory |
Method Summary | |
---|---|
void |
cancelConnections(String hostname,
int port,
IOException ioe)
Interrupt the connections to the given ip:port server. |
com.google.protobuf.BlockingRpcChannel |
createBlockingRpcChannel(ServerName sn,
User ticket,
int rpcTimeout)
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,
int rpcTimeout,
Codec codec,
org.apache.hadoop.io.compress.CompressionCodec compressor)
|
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. |
static int |
getRpcTimeout()
|
static int |
getRpcTimeout(int defaultTimeout)
Returns the lower of the thread-local RPC time from setRpcTimeout(int) and the given
default timeout. |
static void |
resetRpcTimeout()
|
static void |
setPingInterval(org.apache.hadoop.conf.Configuration conf,
int pingInterval)
set the ping interval value in configuration |
static void |
setRpcTimeout(int t)
|
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 |
---|
public static final org.apache.commons.logging.Log LOG
protected final PoolMap<RpcClient.ConnectionId,RpcClient.Connection> connections
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 org.apache.hadoop.hbase.ipc.RpcClient.FailedServers failedServers
protected final SocketFactory socketFactory
protected String clusterId
protected final SocketAddress localAddr
protected final MetricsConnection metrics
public static final String PING_INTERVAL_NAME
public static final String SOCKET_TIMEOUT
public static final String FAILED_SERVER_EXPIRY_KEY
public static final int FAILED_SERVER_EXPIRY_DEFAULT
public static final String IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_KEY
public static final boolean IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_DEFAULT
protected static final Map<org.apache.hadoop.hbase.protobuf.generated.AuthenticationProtos.TokenIdentifier.Kind,org.apache.hadoop.security.token.TokenSelector<? extends org.apache.hadoop.security.token.TokenIdentifier>> tokenHandlers
Constructor Detail |
---|
public RpcClient(org.apache.hadoop.conf.Configuration conf, String clusterId)
RpcClient
without metrics.
public RpcClient(org.apache.hadoop.conf.Configuration conf, String clusterId, MetricsConnection metrics)
clusterId
with the default SocketFactory
conf
- configurationclusterId
- public RpcClient(org.apache.hadoop.conf.Configuration conf, String clusterId, SocketAddress localAddr, MetricsConnection metrics)
clusterId
with the default SocketFactory
conf
- configurationclusterId
- localAddr
- client socket bind address.Method 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 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
- 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()
protected IOException wrapException(InetSocketAddress addr, IOException exception)
addr
- target addressexception
- the relevant exception
public void cancelConnections(String hostname, int port, IOException ioe)
protected RpcClient.Connection getConnection(User ticket, RpcClient.Call call, InetSocketAddress addr, int rpcTimeout, Codec codec, org.apache.hadoop.io.compress.CompressionCodec compressor) throws IOException, InterruptedException
IOException
InterruptedException
public static void setRpcTimeout(int t)
public static int getRpcTimeout()
public static int getRpcTimeout(int defaultTimeout)
setRpcTimeout(int)
and the given
default timeout.
public static void resetRpcTimeout()
public com.google.protobuf.BlockingRpcChannel createBlockingRpcChannel(ServerName sn, User ticket, int rpcTimeout)
sn
- ticket
- rpcTimeout
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |