@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 java.util.concurrent.atomic.AtomicInteger |
callIdCnt |
static java.lang.String |
CLIENT_MAX_THREADS |
static java.lang.String |
USE_GLOBAL_EVENT_LOOP_GROUP |
static java.lang.String |
USE_NATIVE_TRANSPORT |
clusterId, codec, compressor, conf, connectTO, failureSleep, fallbackAllowed, ipcUtil, localAddr, LOG, maxRetries, minIdleTimeBeforeClose, readTO, tcpKeepAlive, tcpNoDelay, userProvider, writeTODEFAULT_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,
java.lang.String clusterId,
java.net.SocketAddress localAddress)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
java.nio.ByteBuffer |
buildCellBlock(CellScanner cells)
Build cell block
|
protected Pair<Message,CellScanner> |
call(PayloadCarryingRpcController pcrc,
Descriptors.MethodDescriptor md,
Message param,
Message returnType,
User ticket,
java.net.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, hasCellBlockSupportpublic static final java.lang.String CLIENT_MAX_THREADS
public static final java.lang.String USE_NATIVE_TRANSPORT
public static final java.lang.String USE_GLOBAL_EVENT_LOOP_GROUP
protected final java.util.concurrent.atomic.AtomicInteger callIdCnt
public AsyncRpcClient(Configuration configuration,
java.lang.String clusterId,
java.net.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, java.net.InetSocketAddress addr) throws java.io.IOException, java.lang.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 AbstractRpcClientticket - 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.java.lang.InterruptedException - if call is interruptedjava.io.IOException - if a connection failure is encounteredpublic void close()
public CellScanner createCellScanner(byte[] cellBlock) throws java.io.IOException
cellBlock - to create scanner forjava.io.IOException - on error on creation cell scannerpublic java.nio.ByteBuffer buildCellBlock(CellScanner cells) throws java.io.IOException
cells - to create block withjava.io.IOException - 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 timeoutjava.io.IOException - when channel could not be created