@InterfaceAudience.LimitedPrivate(value="Configuration") public class AsyncRpcClient extends AbstractRpcClient
Modifier and Type | Class and Description |
---|---|
static class |
AsyncRpcClient.RpcChannelImplementation
Blocking rpc channel that goes via hbase rpc.
|
AbstractRpcClient.BlockingRpcChannelImplementation
Modifier and Type | Field and Description |
---|---|
protected AtomicInteger |
callIdCnt |
static String |
CLIENT_MAX_THREADS |
static String |
USE_GLOBAL_EVENT_LOOP_GROUP |
static String |
USE_NATIVE_TRANSPORT |
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 |
---|
AsyncRpcClient(Configuration configuration,
String clusterId,
SocketAddress localAddress)
Constructor
|
Modifier and Type | Method and Description |
---|---|
ByteBuffer |
buildCellBlock(CellScanner cells)
Build cell block
|
protected Pair<Message,CellScanner> |
call(PayloadCarryingRpcController pcrc,
Descriptors.MethodDescriptor md,
Message param,
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()
Close netty
|
CellScanner |
createCellScanner(byte[] cellBlock)
Create a cell scanner
|
RpcChannel |
createRpcChannel(ServerName sn,
User user,
int rpcTimeout)
Creates a "channel" that can be used by a protobuf service.
|
void |
removeConnection(AsyncRpcChannel connection)
Remove connection from pool
|
createBlockingRpcChannel, getDefaultCodec, getPoolSize, getPoolType
public static final String CLIENT_MAX_THREADS
public static final String USE_NATIVE_TRANSPORT
public static final String USE_GLOBAL_EVENT_LOOP_GROUP
protected final AtomicInteger callIdCnt
public AsyncRpcClient(Configuration configuration, String clusterId, SocketAddress localAddress)
configuration
- to HBaseclusterId
- for the clusterlocalAddress
- local address to connect toprotected Pair<Message,CellScanner> call(PayloadCarryingRpcController pcrc, Descriptors.MethodDescriptor md, Message param, 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
- if call is interruptedIOException
- if a connection failure is encounteredpublic void close()
public CellScanner createCellScanner(byte[] cellBlock) throws IOException
cellBlock
- to create scanner forIOException
- on error on creation cell scannerpublic ByteBuffer buildCellBlock(CellScanner cells) throws IOException
cells
- to create block withIOException
- if block creation failspublic void cancelConnections(ServerName sn)
sn
- server to cancel connections forpublic void removeConnection(AsyncRpcChannel connection)
public RpcChannel createRpcChannel(ServerName sn, User user, int rpcTimeout)
sn
- server name describing location of serveruser
- which is to use the connectionrpcTimeout
- default rpc operation timeoutIOException
- when channel could not be created