@InterfaceAudience.Private public class RpcClientImpl extends AbstractRpcClient
See HBaseServer
Modifier and Type | Class and Description |
---|---|
private static class |
RpcClientImpl.CallFuture
|
protected class |
RpcClientImpl.Connection
Thread that reads responses and notifies callers.
|
AbstractRpcClient.BlockingRpcChannelImplementation
Modifier and Type | Field and Description |
---|---|
protected AtomicInteger |
callIdCnt |
protected PoolMap<ConnectionId,RpcClientImpl.Connection> |
connections |
protected FailedServers |
failedServers |
private static org.apache.commons.logging.Log |
LOG |
protected AtomicBoolean |
running |
protected SocketFactory |
socketFactory |
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>> |
tokenHandlers |
clusterId, codec, compressor, conf, connectTO, failureSleep, fallbackAllowed, ipcUtil, localAddr, maxRetries, metrics, minIdleTimeBeforeClose, readTO, tcpKeepAlive, tcpNoDelay, userProvider, 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 |
---|
RpcClientImpl(org.apache.hadoop.conf.Configuration conf,
String clusterId)
Used in test only.
|
RpcClientImpl(org.apache.hadoop.conf.Configuration conf,
String clusterId,
SocketAddress localAddr,
MetricsConnection metrics)
Construct an IPC client for the cluster
clusterId with the default SocketFactory
This method is called with reflection by the RpcClientFactory to create an instance |
RpcClientImpl(org.apache.hadoop.conf.Configuration conf,
String clusterId,
SocketFactory factory)
Used in test only.
|
RpcClientImpl(org.apache.hadoop.conf.Configuration conf,
String clusterId,
SocketFactory factory,
SocketAddress localAddr,
MetricsConnection metrics)
Construct an IPC cluster client whose values are of the
Message class. |
Modifier and Type | Method and Description |
---|---|
protected Pair<com.google.protobuf.Message,CellScanner> |
call(PayloadCarryingRpcController pcrc,
com.google.protobuf.Descriptors.MethodDescriptor md,
com.google.protobuf.Message param,
com.google.protobuf.Message returnType,
User ticket,
InetSocketAddress addr,
MetricsConnection.CallStats callStats)
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. |
void |
cancelConnections(ServerName sn)
Interrupt the connections to the given ip:port server.
|
void |
close()
Stop all threads related to this client.
|
protected RpcClientImpl.Connection |
createConnection(ConnectionId remoteId,
Codec codec,
org.apache.hadoop.io.compress.CompressionCodec compressor)
Creates a connection.
|
protected RpcClientImpl.Connection |
getConnection(User ticket,
Call call,
InetSocketAddress addr)
Get a connection from the pool, or create a new one and add it to the
pool.
|
callBlockingMethod, createBlockingRpcChannel, getCodec, getDefaultCodec, getPoolSize, getPoolType, hasCellBlockSupport, wrapException
private static final org.apache.commons.logging.Log LOG
protected final AtomicInteger callIdCnt
protected final PoolMap<ConnectionId,RpcClientImpl.Connection> connections
protected final AtomicBoolean running
protected final FailedServers failedServers
protected final SocketFactory socketFactory
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
RpcClientImpl(org.apache.hadoop.conf.Configuration conf, String clusterId, SocketFactory factory)
Message
class.conf
- configurationclusterId
- the cluster idfactory
- socket factoryRpcClientImpl(org.apache.hadoop.conf.Configuration conf, String clusterId, SocketFactory factory, SocketAddress localAddr, MetricsConnection metrics)
Message
class.conf
- configurationclusterId
- the cluster idfactory
- socket factorylocalAddr
- client socket bind addressmetrics
- the connection metricsRpcClientImpl(org.apache.hadoop.conf.Configuration conf, String clusterId)
clusterId
with
the default SocketFactorypublic RpcClientImpl(org.apache.hadoop.conf.Configuration conf, String clusterId, SocketAddress localAddr, MetricsConnection metrics)
clusterId
with the default SocketFactory
This method is called with reflection by the RpcClientFactory to create an instanceconf
- configurationclusterId
- the cluster idlocalAddr
- client socket bind address.metrics
- the connection metricsprotected RpcClientImpl.Connection createConnection(ConnectionId remoteId, Codec codec, org.apache.hadoop.io.compress.CompressionCodec compressor) throws IOException
remoteId
- - the ConnectionId to use for the connection creation.IOException
public void close()
protected Pair<com.google.protobuf.Message,CellScanner> call(PayloadCarryingRpcController pcrc, com.google.protobuf.Descriptors.MethodDescriptor md, com.google.protobuf.Message param, com.google.protobuf.Message returnType, User ticket, InetSocketAddress addr, MetricsConnection.CallStats callStats) throws IOException, 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.call
in class AbstractRpcClient
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.InterruptedException
IOException
public void cancelConnections(ServerName sn)
sn
- server location to cancel connections ofprotected RpcClientImpl.Connection getConnection(User ticket, Call call, InetSocketAddress addr) throws IOException
IOException
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.