@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<org.apache.hadoop.hbase.ipc.ConnectionId,T> |
connections |
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 |
running |
protected boolean |
tcpKeepAlive |
protected boolean |
tcpNoDelay |
protected static Map<AuthenticationProtos.TokenIdentifier.Kind,org.apache.hadoop.security.token.TokenSelector<? extends org.apache.hadoop.security.token.TokenIdentifier>> |
TOKEN_HANDLERS |
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() |
public static final org.slf4j.Logger LOG
protected static final org.apache.hbase.thirdparty.io.netty.util.HashedWheelTimer WHEEL_TIMER
protected static final Map<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
public AbstractRpcClient(org.apache.hadoop.conf.Configuration conf, String clusterId, SocketAddress localAddr, MetricsConnection metrics)
clusterId
conf
- 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 RpcClient
Codec
and so
supports cell blocks.protected abstract T createConnection(org.apache.hadoop.hbase.ipc.ConnectionId remoteId) throws IOException
IOException
public void cancelConnections(ServerName sn)
cancelConnections
in interface RpcClient
sn
- server location to cancel connections ofprotected abstract void closeInternal()
public void close()
RpcClient
public org.apache.hbase.thirdparty.com.google.protobuf.BlockingRpcChannel createBlockingRpcChannel(ServerName sn, User ticket, int rpcTimeout) throws UnknownHostException
RpcClient
createBlockingRpcChannel
in interface RpcClient
sn
- server name describing location of serverticket
- which is to use the connectionrpcTimeout
- default rpc operation timeoutUnknownHostException
public org.apache.hbase.thirdparty.com.google.protobuf.RpcChannel createRpcChannel(ServerName sn, User user, int rpcTimeout) throws UnknownHostException
RpcClient
createRpcChannel
in interface RpcClient
sn
- server name describing location of serveruser
- which is to use the connectionrpcTimeout
- default rpc operation timeoutUnknownHostException
Copyright © 2007–2019 Cloudera. All rights reserved.