org.apache.zookeeper.server
Class NIOServerCnxn.Factory
java.lang.Object
java.lang.Thread
org.apache.zookeeper.server.NIOServerCnxn.Factory
- All Implemented Interfaces:
- Runnable
- Enclosing class:
- NIOServerCnxn
public static class NIOServerCnxn.Factory
- extends Thread
Constructor Summary |
NIOServerCnxn.Factory(InetSocketAddress addr)
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). |
NIOServerCnxn.Factory(InetSocketAddress addr,
int maxcc)
Constructs a new server connection factory where the number of concurrent connections
from a single IP address is limited to maxcc (or unlimited if 0). |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, stop, suspend, toString, yield |
NIOServerCnxn.Factory
public NIOServerCnxn.Factory(InetSocketAddress addr)
throws IOException
- 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). startup(zks) must be called subsequently.
- Parameters:
port
-
- Throws:
IOException
NIOServerCnxn.Factory
public NIOServerCnxn.Factory(InetSocketAddress addr,
int maxcc)
throws IOException
- Constructs a new server connection factory where the number of concurrent connections
from a single IP address is limited to maxcc (or unlimited if 0).
startup(zks) must be called subsequently.
- Parameters:
port
- - the port to listen on for connections.maxcc
- - the number of concurrent connections allowed from a single client.
- Throws:
IOException
start
public void start()
- Overrides:
start
in class Thread
startup
public void startup(ZooKeeperServer zks)
throws IOException,
InterruptedException
- Throws:
IOException
InterruptedException
setZooKeeperServer
public void setZooKeeperServer(ZooKeeperServer zks)
getZooKeeperServer
public ZooKeeperServer getZooKeeperServer()
getLocalAddress
public InetSocketAddress getLocalAddress()
getLocalPort
public int getLocalPort()
getMaxClientCnxns
public int getMaxClientCnxns()
createConnection
protected NIOServerCnxn createConnection(SocketChannel sock,
SelectionKey sk)
throws IOException
- Throws:
IOException
run
public void run()
- Specified by:
run
in interface Runnable
- Overrides:
run
in class Thread
clear
public void clear()
- Clear all the connections in the selector.
You must first close ss (the serversocketchannel) if you wish
to block any new connections from being established.
shutdown
public void shutdown()
Copyright © 2012 The Apache Software Foundation