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:
java.lang.Runnable
Enclosing class:
NIOServerCnxn

public static class NIOServerCnxn.Factory
extends java.lang.Thread


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
NIOServerCnxn.Factory(java.net.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(java.net.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).
 
Method Summary
 void clear()
          Clear all the connections in the selector.
protected  NIOServerCnxn createConnection(java.nio.channels.SocketChannel sock, java.nio.channels.SelectionKey sk)
           
 java.net.InetSocketAddress getLocalAddress()
           
 int getLocalPort()
           
 int getMaxClientCnxns()
           
 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, 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
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NIOServerCnxn.Factory

public NIOServerCnxn.Factory(java.net.InetSocketAddress addr)
                      throws java.io.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:
java.io.IOException

NIOServerCnxn.Factory

public NIOServerCnxn.Factory(java.net.InetSocketAddress addr,
                             int maxcc)
                      throws java.io.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:
java.io.IOException
Method Detail

start

public void start()
Overrides:
start in class java.lang.Thread

startup

public void startup(ZooKeeperServer zks)
             throws java.io.IOException,
                    java.lang.InterruptedException
Throws:
java.io.IOException
java.lang.InterruptedException

setZooKeeperServer

public void setZooKeeperServer(ZooKeeperServer zks)

getZooKeeperServer

public ZooKeeperServer getZooKeeperServer()

getLocalAddress

public java.net.InetSocketAddress getLocalAddress()

getLocalPort

public int getLocalPort()

getMaxClientCnxns

public int getMaxClientCnxns()

createConnection

protected NIOServerCnxn createConnection(java.nio.channels.SocketChannel sock,
                                         java.nio.channels.SelectionKey sk)
                                  throws java.io.IOException
Throws:
java.io.IOException

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.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 © 2011 The Apache Software Foundation