Class AbstractServerBase<REQ extends MessageBody,RESP extends MessageBody>
java.lang.Object
org.apache.flink.queryablestate.network.AbstractServerBase<REQ,RESP>
- Type Parameters:
REQ- the type of request the server expects to receive.RESP- the type of response the server will send.
@Internal
public abstract class AbstractServerBase<REQ extends MessageBody,RESP extends MessageBody>
extends Object
The base class for every server in the queryable state module. It is using pure netty to send and
receive messages of type
MessageBody.-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractServerBase(String serverName, String bindAddress, Iterator<Integer> bindPortIterator, Integer numEventLoopThreads, Integer numQueryThreads) Creates theAbstractServerBase. -
Method Summary
Modifier and TypeMethodDescriptionprotected ExecutorServiceReturns the thread-pool responsible for processing incoming requests.Returns the address of this server.Gets the name of the server.abstract AbstractServerHandler<REQ,RESP> Returns thehandlerto be used for serving the incoming requests.booleanShuts down the server and all related thread pools.voidstart()Starts the server by binding to the configured bind address (blocking).
-
Field Details
-
log
protected final org.slf4j.Logger log
-
-
Constructor Details
-
AbstractServerBase
protected AbstractServerBase(String serverName, String bindAddress, Iterator<Integer> bindPortIterator, Integer numEventLoopThreads, Integer numQueryThreads) Creates theAbstractServerBase.The server needs to be started via
start().- Parameters:
serverName- the name of the serverbindAddress- address to bind tobindPortIterator- port to bind tonumEventLoopThreads- number of event loop threads
-
-
Method Details
-
getQueryExecutor
Returns the thread-pool responsible for processing incoming requests. -
getServerName
Gets the name of the server. This is useful for debugging.- Returns:
- The name of the server.
-
initializeHandler
Returns thehandlerto be used for serving the incoming requests. -
getServerAddress
Returns the address of this server.- Returns:
- AbstractServerBase address
- Throws:
IllegalStateException- If server has not been started yet
-
start
Starts the server by binding to the configured bind address (blocking). -
shutdownServer
Shuts down the server and all related thread pools.- Returns:
- A
CompletableFuturethat will be completed upon termination of the shutdown process.
-
isEventGroupShutdown
@VisibleForTesting public boolean isEventGroupShutdown()
-