org.apache.zookeeper.server
Class NIOServerCnxn.Factory

java.lang.Object
  extended by java.lang.Thread
      extended by org.apache.zookeeper.server.NIOServerCnxn.Factory
All Implemented Interfaces:
Runnable
Enclosing class:
NIOServerCnxn

public static class NIOServerCnxn.Factory
extends Thread


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
NIOServerCnxn.Factory(int port)
          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(int port, 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).
 
Method Summary
 void clear()
          clear all the connections in the selector
protected  NIOServerCnxn createConnection(SocketChannel sock, SelectionKey sk)
           
 InetSocketAddress getLocalAddress()
           
 int getLocalPort()
           
 ZooKeeperServer getZooKeeperServer()
           
 void run()
           
 void setZooKeeperServer(ZooKeeperServer zks)
           
 void shutdown()
           
 void start()
           
 void startup(ZooKeeperServer zks)
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NIOServerCnxn.Factory

public NIOServerCnxn.Factory(int port)
                      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(int port,
                             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
Method Detail

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()

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


shutdown

public void shutdown()