public class NIOServerCnxnFactory extends ServerCnxnFactory
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, saslServerCallbackHandler, secure, zkServer, 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 |
addSession(long sessionId,
NIOServerCnxn cnxn) |
void |
closeAll()
clear all the connections in the selector
|
boolean |
closeSession(long sessionId) |
void |
configure(InetSocketAddress addr,
int maxcc,
boolean secure) |
protected NIOServerCnxn |
createConnection(SocketChannel sock,
SelectionKey sk,
org.apache.zookeeper.server.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)
|
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
|
configure, configureSaslLogin, createFactory, createFactory, createFactory, getNumAliveConnections, getZooKeeperServer, isSecure, registerConnection, 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, 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 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, org.apache.zookeeper.server.NIOServerCnxnFactory.SelectorThread selectorThread) throws IOException
IOException
public void closeAll()
closeAll
in class ServerCnxnFactory
public void stop()
public void shutdown()
shutdown
in class ServerCnxnFactory
public void addSession(long sessionId, NIOServerCnxn cnxn)
public boolean closeSession(long sessionId)
closeSession
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–2020 The Apache Software Foundation. All rights reserved.