@InterfaceAudience.Private
public abstract class AbstractRpcClient
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractRpcClient.BlockingRpcChannelImplementation
Blocking rpc channel that goes via hbase rpc.
|
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
clusterId |
protected org.apache.hadoop.hbase.codec.Codec |
codec |
protected org.apache.hadoop.io.compress.CompressionCodec |
compressor |
protected org.apache.hadoop.conf.Configuration |
conf |
protected int |
connectTO |
static java.lang.String |
DEFAULT_CODEC_CLASS |
static int |
DEFAULT_SOCKET_TIMEOUT_CONNECT |
static int |
DEFAULT_SOCKET_TIMEOUT_READ |
static int |
DEFAULT_SOCKET_TIMEOUT_WRITE |
protected long |
failureSleep |
protected boolean |
fallbackAllowed |
static java.lang.String |
IDLE_TIME |
protected org.apache.hadoop.hbase.ipc.IPCUtil |
ipcUtil |
protected java.net.SocketAddress |
localAddr |
static org.apache.commons.logging.Log |
LOG |
protected int |
maxRetries |
protected int |
minIdleTimeBeforeClose |
protected int |
readTO |
static java.lang.String |
SOCKET_TIMEOUT_CONNECT |
static java.lang.String |
SOCKET_TIMEOUT_READ
How long we wait when we wait for an answer.
|
static java.lang.String |
SOCKET_TIMEOUT_WRITE |
protected boolean |
tcpKeepAlive |
protected boolean |
tcpNoDelay |
protected org.apache.hadoop.hbase.security.UserProvider |
userProvider |
protected int |
writeTO |
| Constructor and Description |
|---|
AbstractRpcClient(org.apache.hadoop.conf.Configuration conf,
java.lang.String clusterId,
java.net.SocketAddress localAddr)
Construct an IPC client for the cluster
clusterId |
| Modifier and Type | Method and Description |
|---|---|
protected abstract org.apache.hadoop.hbase.util.Pair<com.google.protobuf.Message,org.apache.hadoop.hbase.CellScanner> |
call(AsyncPayloadCarryingRpcController pcrc,
com.google.protobuf.Descriptors.MethodDescriptor md,
com.google.protobuf.Message param,
com.google.protobuf.Message returnType,
org.apache.hadoop.hbase.security.User ticket,
java.net.InetSocketAddress isa)
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. |
com.google.protobuf.BlockingRpcChannel |
createBlockingRpcChannel(org.apache.hadoop.hbase.ServerName sn,
org.apache.hadoop.hbase.security.User ticket,
int defaultOperationTimeout) |
static java.lang.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 org.apache.hadoop.hbase.util.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. |
public static final java.lang.String IDLE_TIME
public static final java.lang.String DEFAULT_CODEC_CLASS
public static final java.lang.String SOCKET_TIMEOUT_CONNECT
public static final java.lang.String SOCKET_TIMEOUT_READ
public static final java.lang.String SOCKET_TIMEOUT_WRITE
public static final int DEFAULT_SOCKET_TIMEOUT_CONNECT
public static final int DEFAULT_SOCKET_TIMEOUT_READ
public static final int DEFAULT_SOCKET_TIMEOUT_WRITE
public static final org.apache.commons.logging.Log LOG
protected final org.apache.hadoop.conf.Configuration conf
protected java.lang.String clusterId
protected final java.net.SocketAddress localAddr
protected org.apache.hadoop.hbase.security.UserProvider userProvider
protected final org.apache.hadoop.hbase.ipc.IPCUtil ipcUtil
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.codec.Codec codec
protected final org.apache.hadoop.io.compress.CompressionCodec compressor
protected final boolean fallbackAllowed
protected final int connectTO
protected final int readTO
protected final int writeTO
public AbstractRpcClient(org.apache.hadoop.conf.Configuration conf,
java.lang.String clusterId,
java.net.SocketAddress localAddr)
clusterIdconf - configurationclusterId - the cluster idlocalAddr - client socket bind address.public static java.lang.String getDefaultCodec(org.apache.hadoop.conf.Configuration c)
protected static org.apache.hadoop.hbase.util.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.ThreadLocalprotected static int getPoolSize(org.apache.hadoop.conf.Configuration config)
PoolMap.PoolType.RoundRobin.config - configurationprotected abstract org.apache.hadoop.hbase.util.Pair<com.google.protobuf.Message,org.apache.hadoop.hbase.CellScanner> call(AsyncPayloadCarryingRpcController pcrc, com.google.protobuf.Descriptors.MethodDescriptor md, com.google.protobuf.Message param, com.google.protobuf.Message returnType, org.apache.hadoop.hbase.security.User ticket, java.net.InetSocketAddress isa) throws java.io.IOException, java.lang.InterruptedException
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.ticket - Be careful which ticket you pass. A new user will mean a new Connection.
UserProvider.getCurrent() makes a new instance of User each time so
will be a
new Connection each time.java.lang.InterruptedExceptionjava.io.IOExceptionpublic com.google.protobuf.BlockingRpcChannel createBlockingRpcChannel(org.apache.hadoop.hbase.ServerName sn,
org.apache.hadoop.hbase.security.User ticket,
int defaultOperationTimeout)