@InterfaceAudience.Private 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 io.netty.util.HashedWheelTimer |
WHEEL_TIMER |
clusterId, codec, compressor, conf, connectTO, DEFAULT_CODEC_CLASS, DEFAULT_SOCKET_TIMEOUT_CONNECT, DEFAULT_SOCKET_TIMEOUT_READ, DEFAULT_SOCKET_TIMEOUT_WRITE, failureSleep, fallbackAllowed, IDLE_TIME, ipcUtil, localAddr, LOG, maxRetries, minIdleTimeBeforeClose, readTO, SOCKET_TIMEOUT_CONNECT, SOCKET_TIMEOUT_READ, SOCKET_TIMEOUT_WRITE, tcpKeepAlive, tcpNoDelay, userProvider, writeTO| Constructor and Description |
|---|
AsyncRpcClient(org.apache.hadoop.conf.Configuration configuration,
java.lang.String clusterId,
java.net.SocketAddress localAddress)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
java.nio.ByteBuffer |
buildCellBlock(org.apache.hadoop.hbase.CellScanner cells)
Build cell block
|
protected org.apache.hadoop.hbase.util.Pair<com.google.protobuf.Message,org.apache.hadoop.hbase.CellScanner> |
call(AsyncPayloadCarryingRpcController pcrc,
com.google.protobuf.Descriptors.MethodDescriptor md,
com.google.protobuf.Message param,
com.google.protobuf.Message returnType,
org.apache.hadoop.hbase.security.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(org.apache.hadoop.hbase.ServerName sn)
Interrupt the connections to the given ip:port server.
|
void |
close()
Close netty
|
org.apache.hadoop.hbase.CellScanner |
createCellScanner(byte[] cellBlock)
Create a cell scanner
|
com.google.protobuf.RpcChannel |
createRpcChannel(org.apache.hadoop.hbase.ServerName sn,
org.apache.hadoop.hbase.security.User user,
int rpcTimeout)
Creates a "channel" that can be used by a protobuf service.
|
io.netty.util.concurrent.EventExecutor |
getEventLoop()
Get netty event loop
|
void |
removeConnection(org.apache.hadoop.hbase.ipc.RpcClient.ConnectionId connectionId)
Remove connection from pool
|
createBlockingRpcChannel, getDefaultCodec, getPoolSize, getPoolTypepublic static final io.netty.util.HashedWheelTimer WHEEL_TIMER
protected final java.util.concurrent.atomic.AtomicInteger callIdCnt
public AsyncRpcClient(org.apache.hadoop.conf.Configuration configuration,
java.lang.String clusterId,
java.net.SocketAddress localAddress)
configuration - to HBaseclusterId - for the clusterlocalAddress - local address to connect toprotected org.apache.hadoop.hbase.util.Pair<com.google.protobuf.Message,org.apache.hadoop.hbase.CellScanner> call(AsyncPayloadCarryingRpcController pcrc, com.google.protobuf.Descriptors.MethodDescriptor md, com.google.protobuf.Message param, com.google.protobuf.Message returnType, org.apache.hadoop.hbase.security.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 org.apache.hadoop.hbase.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(org.apache.hadoop.hbase.CellScanner cells)
throws java.io.IOException
cells - to create block withjava.io.IOException - if block creation failspublic void cancelConnections(org.apache.hadoop.hbase.ServerName sn)
sn - server to cancel connections forpublic void removeConnection(org.apache.hadoop.hbase.ipc.RpcClient.ConnectionId connectionId)
connectionId - of connectionpublic com.google.protobuf.RpcChannel createRpcChannel(org.apache.hadoop.hbase.ServerName sn,
org.apache.hadoop.hbase.security.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 createdpublic io.netty.util.concurrent.EventExecutor getEventLoop()