@InterfaceAudience.Private public abstract class AbstractRpcClient<T extends org.apache.hadoop.hbase.ipc.RpcConnection> extends Object implements RpcClient
Locking schema of the current IPC implementation
AbstractRpcClient to protect the fetching or creating
connection.Call to make sure that we can only finish the call once.HBaseRpcController as Call. And see the comment of
HBaseRpcController.notifyOnCancel(RpcCallback, HBaseRpcController.CancellationCallback)
of how to deal with cancel.Call and HBaseRpcController's lock should be held
at last. So the callbacks in Call and HBaseRpcController should be execute
outside the lock in Call and HBaseRpcController which means the implementations
of the callbacks are free to hold any lock.| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractRpcClient.BlockingRpcChannelImplementation
Blocking rpc channel that goes via hbase rpc.
|
static class |
AbstractRpcClient.RpcChannelImplementation
Async rpc channel that goes via hbase rpc.
|
| Modifier and Type | Field and Description |
|---|---|
protected org.apache.hadoop.hbase.ipc.CellBlockBuilder |
cellBlockBuilder |
protected String |
clusterId |
protected Codec |
codec |
protected org.apache.hadoop.io.compress.CompressionCodec |
compressor |
protected org.apache.hadoop.conf.Configuration |
conf |
protected int |
connectTO |
protected FailedServers |
failedServers |
protected long |
failureSleep |
protected boolean |
fallbackAllowed |
protected SocketAddress |
localAddr |
static org.slf4j.Logger |
LOG |
protected int |
maxRetries |
protected MetricsConnection |
metrics |
protected int |
minIdleTimeBeforeClose |
protected int |
readTO |
protected boolean |
tcpKeepAlive |
protected boolean |
tcpNoDelay |
protected UserProvider |
userProvider |
protected static org.apache.hbase.thirdparty.io.netty.util.HashedWheelTimer |
WHEEL_TIMER |
protected int |
writeTO |
DEFAULT_CODEC_CLASS, DEFAULT_SOCKET_TIMEOUT_CONNECT, DEFAULT_SOCKET_TIMEOUT_READ, DEFAULT_SOCKET_TIMEOUT_WRITE, FAILED_SERVER_EXPIRY_DEFAULT, FAILED_SERVER_EXPIRY_KEY, IDLE_TIME, IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_DEFAULT, IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_KEY, PING_CALL_ID, SOCKET_TIMEOUT_CONNECT, SOCKET_TIMEOUT_READ, SOCKET_TIMEOUT_WRITE, SPECIFIC_WRITE_THREAD| Constructor and Description |
|---|
AbstractRpcClient(org.apache.hadoop.conf.Configuration conf,
String clusterId,
SocketAddress localAddr,
MetricsConnection metrics)
Construct an IPC client for the cluster
clusterId |
| Modifier and Type | Method and Description |
|---|---|
void |
cancelConnections(ServerName sn)
Interrupt the connections to the given ip:port server.
|
void |
close()
Stop all threads related to this client.
|
protected abstract void |
closeInternal() |
org.apache.hbase.thirdparty.com.google.protobuf.BlockingRpcChannel |
createBlockingRpcChannel(ServerName sn,
User ticket,
int rpcTimeout)
Creates a "channel" that can be used by a blocking protobuf service.
|
protected abstract T |
createConnection(org.apache.hadoop.hbase.ipc.ConnectionId remoteId)
Not connected.
|
org.apache.hbase.thirdparty.com.google.protobuf.RpcChannel |
createRpcChannel(ServerName sn,
User user,
int rpcTimeout)
Creates a "channel" that can be used by a protobuf service.
|
static String |
getDefaultCodec(org.apache.hadoop.conf.Configuration c) |
boolean |
hasCellBlockSupport()
Return true when this client uses a
Codec and so supports
cell blocks. |
public static final org.slf4j.Logger LOG
protected static final org.apache.hbase.thirdparty.io.netty.util.HashedWheelTimer WHEEL_TIMER
protected final org.apache.hadoop.conf.Configuration conf
protected final String clusterId
protected final SocketAddress localAddr
protected final MetricsConnection metrics
protected final UserProvider userProvider
protected final org.apache.hadoop.hbase.ipc.CellBlockBuilder cellBlockBuilder
protected final int minIdleTimeBeforeClose
protected final int maxRetries
protected final long failureSleep
protected final boolean tcpNoDelay
protected final boolean tcpKeepAlive
protected final Codec codec
protected final org.apache.hadoop.io.compress.CompressionCodec compressor
protected final boolean fallbackAllowed
protected final FailedServers failedServers
protected final int connectTO
protected final int readTO
protected final int writeTO
public AbstractRpcClient(org.apache.hadoop.conf.Configuration conf,
String clusterId,
SocketAddress localAddr,
MetricsConnection metrics)
clusterIdconf - configurationclusterId - the cluster idlocalAddr - client socket bind address.metrics - the connection metricspublic static String getDefaultCodec(org.apache.hadoop.conf.Configuration c)
public boolean hasCellBlockSupport()
RpcClientCodec and so supports
cell blocks.hasCellBlockSupport in interface RpcClientprotected abstract T createConnection(org.apache.hadoop.hbase.ipc.ConnectionId remoteId) throws IOException
IOExceptionpublic void cancelConnections(ServerName sn)
cancelConnections in interface RpcClientsn - server location to cancel connections ofprotected abstract void closeInternal()
public void close()
RpcClientpublic org.apache.hbase.thirdparty.com.google.protobuf.BlockingRpcChannel createBlockingRpcChannel(ServerName sn, User ticket, int rpcTimeout)
RpcClientcreateBlockingRpcChannel in interface RpcClientsn - server name describing location of serverticket - which is to use the connectionrpcTimeout - default rpc operation timeoutpublic org.apache.hbase.thirdparty.com.google.protobuf.RpcChannel createRpcChannel(ServerName sn, User user, int rpcTimeout)
RpcClientcreateRpcChannel in interface RpcClientsn - server name describing location of serveruser - which is to use the connectionrpcTimeout - default rpc operation timeoutCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.