public class KvStateServer extends Object
KvStateRequest messages.
Requests are handled by asynchronous query tasks (see KvStateServerHandler.AsyncKvStateQueryTask)
that are executed by a separate query Thread pool. This pool is shared among
all TCP connections.
The incoming pipeline looks as follows:
Socket.read() -> LengthFieldBasedFrameDecoder -> KvStateServerHandler
Received binary messages are expected to contain a frame length field. Netty's
LengthFieldBasedFrameDecoder is used to fully receive the frame before
giving it to our KvStateServerHandler.
Connections are established and closed by the client. The server only closes the connection on a fatal failure that cannot be recovered. A server-side connection close is considered a failure by the client.
| Constructor and Description |
|---|
KvStateServer(InetAddress bindAddress,
int bindPort,
int numEventLoopThreads,
int numQueryThreads,
KvStateRegistry kvStateRegistry,
KvStateRequestStats stats)
Creates the
KvStateServer. |
| Modifier and Type | Method and Description |
|---|---|
KvStateServerAddress |
getAddress()
Returns the address of this server.
|
void |
shutDown()
Shuts down the server and all related thread pools.
|
void |
start()
Starts the server by binding to the configured bind address (blocking).
|
public KvStateServer(InetAddress bindAddress, int bindPort, int numEventLoopThreads, int numQueryThreads, KvStateRegistry kvStateRegistry, KvStateRequestStats stats)
KvStateServer.
The server needs to be started via start() in order to bind
to the configured bind address.
bindAddress - Address to bind tobindPort - Port to bind to. Pick random port if 0.numEventLoopThreads - Number of event loop threadsnumQueryThreads - Number of query threadskvStateRegistry - KvStateRegistry to query for KvState instancesstats - Statistics trackerpublic void start()
throws InterruptedException
InterruptedException - If interrupted during the bind operationpublic KvStateServerAddress getAddress()
IllegalStateException - If server has not been started yetpublic void shutDown()
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.