@InterfaceAudience.Private public class RpcClientImpl extends AbstractRpcClient
See HBaseServer
Modifier and Type | Class and Description |
---|---|
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 |
protected AtomicBoolean |
running |
protected SocketFactory |
socketFactory |
protected static Map<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, LOG, maxRetries, 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)
Construct an IPC client for the cluster
clusterId with the default SocketFactory |
RpcClientImpl(org.apache.hadoop.conf.Configuration conf,
String clusterId,
SocketAddress localAddr)
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 |
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)
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.
|
createBlockingRpcChannel, getDefaultCodec, getPoolSize, getPoolType, hasCellBlockSupport, wrapException
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<AuthenticationProtos.TokenIdentifier.Kind,org.apache.hadoop.security.token.TokenSelector<? extends org.apache.hadoop.security.token.TokenIdentifier>> tokenHandlers
public RpcClientImpl(org.apache.hadoop.conf.Configuration conf, String clusterId)
clusterId
with the default SocketFactoryconf
- configurationclusterId
- the cluster idpublic RpcClientImpl(org.apache.hadoop.conf.Configuration conf, String clusterId, SocketAddress localAddr)
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.protected 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) 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-2016 The Apache Software Foundation. All Rights Reserved.