Package org.apache.hadoop.hbase.ipc
Class SimpleRpcServer
java.lang.Object
org.apache.hadoop.hbase.ipc.RpcServer
org.apache.hadoop.hbase.ipc.SimpleRpcServer
- All Implemented Interfaces:
ConfigurationObserver
,RpcServerInterface
Deprecated.
The RPC server with native java NIO implementation deriving from Hadoop to host protobuf
described Services. It's the original one before HBASE-17262, and the default RPC server for now.
An RpcServer instance has a Listener that hosts the socket. Listener has fixed number of Readers
in an ExecutorPool, 10 by default. The Listener does an accept and then round robin a Reader is
chosen to do the read. The reader is registered on Selector. Read does total read off the channel
and the parse from which it makes a Call. The call is wrapped in a CallRunner and passed to the
scheduler to be run. Reader goes back to see if more to be done and loops till done.
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.
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate class
Deprecated.private class
Deprecated.Listens on the socket.Nested classes/interfaces inherited from class org.apache.hadoop.hbase.ipc.RpcServer
RpcServer.BlockingServiceAndInterface, RpcServer.CallCleanup
-
Field Summary
Modifier and TypeFieldDescriptionprotected InetSocketAddress
Deprecated.Deprecated.private SimpleRpcServer.Listener
Deprecated.protected int
Deprecated.protected final long
Deprecated.private int
Deprecated.protected SimpleRpcServerResponder
Deprecated.protected int
Deprecated.Fields inherited from class org.apache.hadoop.hbase.ipc.RpcServer
allowFallbackToSimpleAuth, AUDITLOG, AUTH_FAILED_FOR, AUTH_SUCCESSFUL_FOR, authManager, authTokenSecretMgr, bbAllocator, 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_TRACE_LOG_MAX_LENGTH, DEFAULT_WARN_RESPONSE_SIZE, DEFAULT_WARN_RESPONSE_TIME, errorHandler, FALLBACK_TO_INSECURE_CLIENT_AUTH, GSON, isSecurityEnabled, KEY_WORD_TRUNCATED, LOG, MAX_REQUEST_SIZE, maxQueueSizeInBytes, maxRequestSize, metrics, MIN_CLIENT_REQUEST_TIMEOUT, minClientRequestTimeout, MONITORED_RPC, NIO_BUFFER_LIMIT, running, saslProps, scheduler, secretManager, server, serverPrincipal, services, started, tcpKeepAlive, tcpNoDelay, TRACE_LOG_MAX_LENGTH, userProvider, WARN_RESPONSE_SIZE, WARN_RESPONSE_TIME, WARN_SCAN_RESPONSE_SIZE, WARN_SCAN_RESPONSE_TIME, warnResponseSize, warnResponseTime, warnScanResponseSize, warnScanResponseTime
-
Constructor Summary
ConstructorDescriptionSimpleRpcServer
(Server server, String name, List<RpcServer.BlockingServiceAndInterface> services, InetSocketAddress bindAddress, org.apache.hadoop.conf.Configuration conf, RpcScheduler scheduler, boolean reservoirEnabled) Deprecated.Constructs a server listening on the named port and address. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
bind
(ServerSocket socket, InetSocketAddress address, int backlog) Deprecated.A convenience method to bind to a given address and report better exceptions if the address is not a valid host.Pair<org.apache.hbase.thirdparty.com.google.protobuf.Message,
CellScanner> call
(org.apache.hbase.thirdparty.com.google.protobuf.BlockingService service, org.apache.hbase.thirdparty.com.google.protobuf.Descriptors.MethodDescriptor md, org.apache.hbase.thirdparty.com.google.protobuf.Message param, CellScanner cellScanner, long receiveTime, MonitoredRPCHandler status) Deprecated.Pair<org.apache.hbase.thirdparty.com.google.protobuf.Message,
CellScanner> call
(org.apache.hbase.thirdparty.com.google.protobuf.BlockingService service, org.apache.hbase.thirdparty.com.google.protobuf.Descriptors.MethodDescriptor md, org.apache.hbase.thirdparty.com.google.protobuf.Message param, CellScanner cellScanner, long receiveTime, MonitoredRPCHandler status, long startTime, int timeout) Deprecated.protected long
channelWrite
(GatheringByteChannel channel, BufferChain bufferChain) Deprecated.protected void
closeConnection
(SimpleServerRpcConnection connection) Deprecated.protected SimpleServerRpcConnection
getConnection
(SocketChannel channel, long time) Deprecated.Subclasses of HBaseServer can override this to provide their own Connection implementations.Deprecated.Return the socket (ip+port) on which the RPC server is listening to.int
Deprecated.The number of open RPC conectionsvoid
join()
Deprecated.Wait for the server to be stopped.void
setSocketSendBufSize
(int size) Deprecated.Sets the socket buffer size used for responding to RPCs.void
start()
Deprecated.Starts the service.void
stop()
Deprecated.Stops the service.Methods inherited from class org.apache.hadoop.hbase.ipc.RpcServer
addCallSize, authorize, call, channelRead, createSecretManager, getByteBuffAllocator, getConf, getCurrentCall, getErrorHandler, getMetrics, getRemoteAddress, getRemoteIp, getRequestUser, getRequestUserName, getScheduler, getSecretManager, getService, getServiceAndInterface, getServiceInterface, getServices, getStatus, initReconfigurable, isInRpcCallContext, isStarted, logResponse, needAuthorization, onConfigurationChange, refreshAuthManager, setCurrentCall, setErrorHandler, setNamedQueueRecorder, setRsRpcServices, setSecretManager, truncateTraceLog, unsetCurrentCall
-
Field Details
-
port
Deprecated. -
address
Deprecated. -
readThreads
Deprecated. -
socketSendBufferSize
Deprecated. -
purgeTimeout
Deprecated. -
connectionManager
Deprecated. -
listener
Deprecated. -
responder
Deprecated.
-
-
Constructor Details
-
SimpleRpcServer
public SimpleRpcServer(Server server, String name, List<RpcServer.BlockingServiceAndInterface> services, InetSocketAddress bindAddress, org.apache.hadoop.conf.Configuration conf, RpcScheduler scheduler, boolean reservoirEnabled) throws IOException Deprecated.Constructs a server listening on the named port and address.- Parameters:
server
- hosting instance ofServer
. 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 listenreservoirEnabled
- Enable ByteBufferPool or not.- Throws:
IOException
-
-
Method Details
-
getConnection
Deprecated.Subclasses of HBaseServer can override this to provide their own Connection implementations. -
closeConnection
Deprecated. -
setSocketSendBufSize
Deprecated.Sets the socket buffer size used for responding to RPCs.- Parameters:
size
- send size
-
start
Deprecated.Starts the service. Must be called before any calls will be handled. -
stop
Deprecated.Stops the service. No new calls will be handled after this is called. -
join
Deprecated.Wait for the server to be stopped. Does not wait for all subthreads to finish.- Throws:
InterruptedException
- See Also:
-
getListenerAddress
Deprecated.Return the socket (ip+port) on which the RPC server is listening to. May return null if the listener channel is closed.- Returns:
- the socket (ip+port) on which the RPC server is listening to, or null if this information cannot be determined
-
call
public Pair<org.apache.hbase.thirdparty.com.google.protobuf.Message,CellScanner> call(org.apache.hbase.thirdparty.com.google.protobuf.BlockingService service, org.apache.hbase.thirdparty.com.google.protobuf.Descriptors.MethodDescriptor md, org.apache.hbase.thirdparty.com.google.protobuf.Message param, CellScanner cellScanner, long receiveTime, MonitoredRPCHandler status) throws IOException Deprecated.- Throws:
IOException
-
call
public Pair<org.apache.hbase.thirdparty.com.google.protobuf.Message,CellScanner> call(org.apache.hbase.thirdparty.com.google.protobuf.BlockingService service, org.apache.hbase.thirdparty.com.google.protobuf.Descriptors.MethodDescriptor md, org.apache.hbase.thirdparty.com.google.protobuf.Message param, CellScanner cellScanner, long receiveTime, MonitoredRPCHandler status, long startTime, int timeout) throws IOException Deprecated.- Throws:
IOException
-
channelWrite
protected long channelWrite(GatheringByteChannel channel, BufferChain bufferChain) throws IOException Deprecated.- Throws:
IOException
-
bind
public static void bind(ServerSocket socket, InetSocketAddress address, int backlog) throws IOException Deprecated.A convenience method to bind to a given address and report better exceptions if the address is not a valid host.- Parameters:
socket
- the socket to bindaddress
- the address to bind tobacklog
- the number of connections allowed in the queue- Throws:
BindException
- if the address can't be boundUnknownHostException
- if the address isn't a valid host nameIOException
- other random errors from bind
-
getNumOpenConnections
Deprecated.The number of open RPC conections- Specified by:
getNumOpenConnections
in classRpcServer
- Returns:
- the number of open rpc connections
-