@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 PoolMap<ConnectionId,T> |
connections |
protected int |
connectTO |
protected FailedServers |
failedServers |
protected long |
failureSleep |
protected boolean |
fallbackAllowed |
protected SocketAddress |
localAddr |
static org.apache.commons.logging.Log |
LOG |
protected int |
maxRetries |
protected MetricsConnection |
metrics |
protected int |
minIdleTimeBeforeClose |
protected int |
readTO |
protected boolean |
running |
protected boolean |
tcpKeepAlive |
protected boolean |
tcpNoDelay |
protected static Map<org.apache.hadoop.hbase.protobuf.generated.AuthenticationProtos.TokenIdentifier.Kind,org.apache.hadoop.security.token.TokenSelector<? extends org.apache.hadoop.security.token.TokenIdentifier>> |
TOKEN_HANDLERS |
protected UserProvider |
userProvider |
protected static 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() |
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(ConnectionId remoteId)
Not connected.
|
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() |
public static final org.apache.commons.logging.Log LOG
protected static final io.netty.util.HashedWheelTimer WHEEL_TIMER
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>> TOKEN_HANDLERS
protected boolean running
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
protected final PoolMap<ConnectionId,T extends org.apache.hadoop.hbase.ipc.RpcConnection> connections
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()
hasCellBlockSupport in interface RpcClientCodec and so
supports cell blocks.protected abstract T createConnection(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 com.google.protobuf.BlockingRpcChannel createBlockingRpcChannel(ServerName sn, User ticket, int rpcTimeout) throws UnknownHostException
RpcClientcreateBlockingRpcChannel in interface RpcClientsn - server name describing location of serverticket - which is to use the connectionrpcTimeout - default rpc operation timeoutUnknownHostExceptionpublic com.google.protobuf.RpcChannel createRpcChannel(ServerName sn, User user, int rpcTimeout) throws UnknownHostException
RpcClientcreateRpcChannel in interface RpcClientsn - server name describing location of serveruser - which is to use the connectionrpcTimeout - default rpc operation timeoutUnknownHostExceptionCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.