@InterfaceAudience.Private @InterfaceStability.Evolving public class SimpleRpcServer extends RpcServer
Scheduler can be variously implemented but default simple scheduler has handlers to which it has given the queues into which calls (i.e. CallRunner instances) are inserted. Handlers run taking from the queue. They run the CallRunner#run method on each item gotten from queue and keep taking while the server is up. CallRunner#run executes the call. When done, asks the included Call to put itself on new queue for Responder to pull from and return result to client.
BlockingRpcClientRpcServer.BlockingServiceAndInterface, RpcServer.CallCleanup| Modifier and Type | Field and Description |
|---|---|
protected InetSocketAddress |
address |
protected int |
port |
protected long |
purgeTimeout |
protected org.apache.hadoop.hbase.ipc.SimpleRpcServerResponder |
responder |
protected int |
socketSendBufferSize |
allowFallbackToSimpleAuth, AUDITLOG, AUTH_FAILED_FOR, AUTH_SUCCESSFUL_FOR, authManager, authTokenSecretMgr, bindAddress, CALL_QUEUE_TOO_BIG_EXCEPTION, callQueueSizeInBytes, cellBlockBuilder, conf, CurCall, CURRENT_VERSION, DEFAULT_MAX_CALLQUEUE_LENGTH_PER_HANDLER, DEFAULT_MAX_CALLQUEUE_SIZE, DEFAULT_MAX_REQUEST_SIZE, DEFAULT_MIN_CLIENT_REQUEST_TIMEOUT, DEFAULT_WARN_RESPONSE_SIZE, DEFAULT_WARN_RESPONSE_TIME, errorHandler, FALLBACK_TO_INSECURE_CLIENT_AUTH, isSecurityEnabled, LOG, MAPPER, MAX_REQUEST_SIZE, maxQueueSizeInBytes, maxRequestSize, metrics, MIN_CLIENT_REQUEST_TIMEOUT, minClientRequestTimeout, minSizeForReservoirUse, MONITORED_RPC, NIO_BUFFER_LIMIT, REQUEST_TOO_BIG_EXCEPTION, reservoir, saslProps, scheduler, secretManager, server, services, tcpKeepAlive, tcpNoDelay, userProvider, WARN_RESPONSE_SIZE, WARN_RESPONSE_TIME, warnResponseSize, warnResponseTime| Constructor and Description |
|---|
SimpleRpcServer(Server server,
String name,
List<RpcServer.BlockingServiceAndInterface> services,
InetSocketAddress bindAddress,
org.apache.hadoop.conf.Configuration conf,
RpcScheduler scheduler)
Constructs a server listening on the named port and address.
|
addCallSize, authorize, call, channelRead, createSecretManager, getCurrentCall, getErrorHandler, getMetrics, getRemoteAddress, getRemoteIp, getRequestUser, getRequestUserName, getScheduler, getSecretManager, getService, getServiceAndInterface, getServiceInterface, getStatus, initReconfigurable, isInRpcCallContext, isStarted, onConfigurationChange, refreshAuthManager, setErrorHandler, setRsRpcServices, setSecretManagerprotected int port
protected InetSocketAddress address
protected int socketSendBufferSize
protected final long purgeTimeout
protected org.apache.hadoop.hbase.ipc.SimpleRpcServerResponder responder
public SimpleRpcServer(Server server, String name, List<RpcServer.BlockingServiceAndInterface> services, InetSocketAddress bindAddress, org.apache.hadoop.conf.Configuration conf, RpcScheduler scheduler) throws IOException
server - hosting instance of Server. We will do authentications if an
instance else pass null for no authentication check.name - Used keying this rpc servers' metrics and for naming the Listener thread.services - A list of services.bindAddress - Where to listenconf - scheduler - IOExceptionprotected org.apache.hadoop.hbase.ipc.SimpleServerRpcConnection getConnection(SocketChannel channel, long time)
protected void closeConnection(org.apache.hadoop.hbase.ipc.SimpleServerRpcConnection connection)
public void setSocketSendBufSize(int size)
size - send sizepublic void start()
public void stop()
public void join()
throws InterruptedException
stop().InterruptedException - epublic InetSocketAddress getListenerAddress()
public Pair<org.apache.hadoop.hbase.shaded.com.google.protobuf.Message,CellScanner> call(org.apache.hadoop.hbase.shaded.com.google.protobuf.BlockingService service, org.apache.hadoop.hbase.shaded.com.google.protobuf.Descriptors.MethodDescriptor md, org.apache.hadoop.hbase.shaded.com.google.protobuf.Message param, CellScanner cellScanner, long receiveTime, MonitoredRPCHandler status) throws IOException
IOExceptionpublic Pair<org.apache.hadoop.hbase.shaded.com.google.protobuf.Message,CellScanner> call(org.apache.hadoop.hbase.shaded.com.google.protobuf.BlockingService service, org.apache.hadoop.hbase.shaded.com.google.protobuf.Descriptors.MethodDescriptor md, org.apache.hadoop.hbase.shaded.com.google.protobuf.Message param, CellScanner cellScanner, long receiveTime, MonitoredRPCHandler status, long startTime, int timeout) throws IOException
IOExceptionprotected long channelWrite(GatheringByteChannel channel, org.apache.hadoop.hbase.ipc.BufferChain bufferChain) throws IOException
WritableByteChannel.write(java.nio.ByteBuffer).
If the amount of data is large, it writes to channel in smaller chunks.
This is to avoid jdk from creating many direct buffers as the size of
buffer increases. This also minimizes extra copies in NIO layer
as a result of multiple write operations required to write a large
buffer.channel - writable byte channel to write tobufferChain - Chain of buffers to writeIOException - eWritableByteChannel.write(java.nio.ByteBuffer)public static void bind(ServerSocket socket, InetSocketAddress address, int backlog) throws IOException
socket - the socket to bindaddress - the address to bind tobacklog - the number of connections allowed in the queueBindException - if the address can't be boundUnknownHostException - if the address isn't a valid host nameIOException - other random errors from bindpublic int getNumOpenConnections()
getNumOpenConnections in class RpcServerCopyright © 2007–2017 The Apache Software Foundation. All rights reserved.