public class NIOServerCnxnFactory extends ServerCnxnFactory
Modifier and Type | Class and Description |
---|---|
class |
NIOServerCnxnFactory.SelectorThread
The SelectorThread receives newly accepted connections from the
AcceptThread and is responsible for selecting for I/O readiness
across the connections.
|
Modifier and Type | Field and Description |
---|---|
protected int |
maxClientCnxns |
protected WorkerService |
workerPool |
static String |
ZOOKEEPER_NIO_DIRECT_BUFFER_BYTES
Default: 64kB
|
static String |
ZOOKEEPER_NIO_NUM_SELECTOR_THREADS
With 500 connections to an observer with watchers firing on each, is
unable to exceed 1GigE rates with only 1 selector.
|
static String |
ZOOKEEPER_NIO_NUM_WORKER_THREADS
Default: 2 * numCores
|
static String |
ZOOKEEPER_NIO_SESSIONLESS_CNXN_TIMEOUT
Default sessionless connection timeout in ms: 10000 (10s)
|
static String |
ZOOKEEPER_NIO_SHUTDOWN_TIMEOUT
Default worker pool shutdown timeout in ms: 5000 (5s)
|
cnxns, login, maxCnxns, saslServerCallbackHandler, secure, zkServer, ZOOKEEPER_MAX_CONNECTION_DEFAULT, ZOOKEEPER_SERVER_CNXN_FACTORY
Constructor and Description |
---|
NIOServerCnxnFactory()
Construct a new server connection factory which will accept an unlimited number
of concurrent connections from each client (up to the file descriptor
limits of the operating system).
|
Modifier and Type | Method and Description |
---|---|
void |
closeAll(ServerCnxn.DisconnectReason reason)
clear all the connections in the selector
|
void |
configure(InetSocketAddress addr,
int maxcc,
int backlog,
boolean secure) |
protected NIOServerCnxn |
createConnection(SocketChannel sock,
SelectionKey sk,
NIOServerCnxnFactory.SelectorThread selectorThread) |
void |
dumpConnections(PrintWriter pwriter) |
Iterable<Map<String,Object>> |
getAllConnectionInfo(boolean brief) |
Iterable<ServerCnxn> |
getConnections() |
static ByteBuffer |
getDirectBuffer() |
InetSocketAddress |
getLocalAddress() |
int |
getLocalPort() |
int |
getMaxClientCnxnsPerHost()
Maximum number of connections allowed from particular host (ip)
|
int |
getSocketListenBacklog()
The maximum queue length of the ZooKeeper server's socket
|
void |
join() |
void |
reconfigure(InetSocketAddress addr) |
boolean |
removeCnxn(NIOServerCnxn cnxn)
De-registers the connection from the various mappings maintained
by the factory.
|
void |
resetAllConnectionStats() |
void |
setMaxClientCnxnsPerHost(int max)
Maximum number of connections allowed from particular host (ip)
|
void |
shutdown() |
void |
start() |
void |
startup(ZooKeeperServer zks,
boolean startServer) |
void |
stop() |
void |
touchCnxn(NIOServerCnxn cnxn)
Add or update cnxn in our cnxnExpiryQueue
|
addSession, closeSession, configure, configure, configureSaslLogin, createFactory, createFactory, createFactory, createFactory, createFactory, getMaxCnxns, getNumAliveConnections, getUserName, getZooKeeperServer, initMaxCnxns, isSecure, limitTotalNumberOfCnxns, registerConnection, removeCnxnFromSessionMap, setZooKeeperServer, startup, unregisterConnection
public static final String ZOOKEEPER_NIO_SESSIONLESS_CNXN_TIMEOUT
public static final String ZOOKEEPER_NIO_NUM_SELECTOR_THREADS
public static final String ZOOKEEPER_NIO_NUM_WORKER_THREADS
public static final String ZOOKEEPER_NIO_DIRECT_BUFFER_BYTES
public static final String ZOOKEEPER_NIO_SHUTDOWN_TIMEOUT
protected int maxClientCnxns
protected WorkerService workerPool
public NIOServerCnxnFactory()
public static ByteBuffer getDirectBuffer()
public void configure(InetSocketAddress addr, int maxcc, int backlog, boolean secure) throws IOException
configure
in class ServerCnxnFactory
IOException
public void reconfigure(InetSocketAddress addr)
reconfigure
in class ServerCnxnFactory
public int getMaxClientCnxnsPerHost()
getMaxClientCnxnsPerHost
in class ServerCnxnFactory
public void setMaxClientCnxnsPerHost(int max)
setMaxClientCnxnsPerHost
in class ServerCnxnFactory
public int getSocketListenBacklog()
getSocketListenBacklog
in class ServerCnxnFactory
public void start()
start
in class ServerCnxnFactory
public void startup(ZooKeeperServer zks, boolean startServer) throws IOException, InterruptedException
startup
in class ServerCnxnFactory
IOException
InterruptedException
public InetSocketAddress getLocalAddress()
getLocalAddress
in class ServerCnxnFactory
public int getLocalPort()
getLocalPort
in class ServerCnxnFactory
public boolean removeCnxn(NIOServerCnxn cnxn)
public void touchCnxn(NIOServerCnxn cnxn)
cnxn
- protected NIOServerCnxn createConnection(SocketChannel sock, SelectionKey sk, NIOServerCnxnFactory.SelectorThread selectorThread) throws IOException
IOException
public void closeAll(ServerCnxn.DisconnectReason reason)
closeAll
in class ServerCnxnFactory
public void stop()
public void shutdown()
shutdown
in class ServerCnxnFactory
public void join() throws InterruptedException
join
in class ServerCnxnFactory
InterruptedException
public Iterable<ServerCnxn> getConnections()
getConnections
in class ServerCnxnFactory
public void dumpConnections(PrintWriter pwriter)
public void resetAllConnectionStats()
resetAllConnectionStats
in class ServerCnxnFactory
public Iterable<Map<String,Object>> getAllConnectionInfo(boolean brief)
getAllConnectionInfo
in class ServerCnxnFactory
Copyright © 2008–2022 The Apache Software Foundation. All rights reserved.