org.apache.zookeeper.server
Class NIOServerCnxnFactory

java.lang.Object
  extended by org.apache.zookeeper.server.ServerCnxnFactory
      extended by org.apache.zookeeper.server.NIOServerCnxnFactory
All Implemented Interfaces:
Runnable

public class NIOServerCnxnFactory
extends ServerCnxnFactory
implements Runnable


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.zookeeper.server.ServerCnxnFactory
ServerCnxnFactory.PacketProcessor
 
Field Summary
 
Fields inherited from class org.apache.zookeeper.server.ServerCnxnFactory
login, saslServerCallbackHandler, zkServer, ZOOKEEPER_SERVER_CNXN_FACTORY
 
Constructor Summary
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).
 
Method Summary
 void closeAll()
          clear all the connections in the selector
 void closeSession(long sessionId)
           
 void configure(InetSocketAddress addr, int maxcc)
           
protected  NIOServerCnxn createConnection(SocketChannel sock, SelectionKey sk)
           
 Iterable<ServerCnxn> getConnections()
           
 InetSocketAddress getLocalAddress()
           
 int getLocalPort()
           
 int getMaxClientCnxnsPerHost()
          Maximum number of connections allowed from particular host (ip)
 void join()
           
 void run()
           
 void setMaxClientCnxnsPerHost(int max)
          Maximum number of connections allowed from particular host (ip)
 void shutdown()
           
 void start()
           
 void startup(ZooKeeperServer zks)
           
 
Methods inherited from class org.apache.zookeeper.server.ServerCnxnFactory
createFactory, createFactory, createFactory, registerConnection, setZooKeeperServer, unregisterConnection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NIOServerCnxnFactory

public NIOServerCnxnFactory()
                     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.

Throws:
IOException
Method Detail

configure

public void configure(InetSocketAddress addr,
                      int maxcc)
               throws IOException
Specified by:
configure in class ServerCnxnFactory
Throws:
IOException

getMaxClientCnxnsPerHost

public int getMaxClientCnxnsPerHost()
Maximum number of connections allowed from particular host (ip)

Specified by:
getMaxClientCnxnsPerHost in class ServerCnxnFactory

setMaxClientCnxnsPerHost

public void setMaxClientCnxnsPerHost(int max)
Maximum number of connections allowed from particular host (ip)

Specified by:
setMaxClientCnxnsPerHost in class ServerCnxnFactory

start

public void start()
Specified by:
start in class ServerCnxnFactory

startup

public void startup(ZooKeeperServer zks)
             throws IOException,
                    InterruptedException
Specified by:
startup in class ServerCnxnFactory
Throws:
IOException
InterruptedException

getLocalAddress

public InetSocketAddress getLocalAddress()
Specified by:
getLocalAddress in class ServerCnxnFactory

getLocalPort

public int getLocalPort()
Specified by:
getLocalPort in class ServerCnxnFactory

createConnection

protected NIOServerCnxn createConnection(SocketChannel sock,
                                         SelectionKey sk)
                                  throws IOException
Throws:
IOException

run

public void run()
Specified by:
run in interface Runnable

closeAll

public void closeAll()
clear all the connections in the selector

Specified by:
closeAll in class ServerCnxnFactory

shutdown

public void shutdown()
Specified by:
shutdown in class ServerCnxnFactory

closeSession

public void closeSession(long sessionId)
Specified by:
closeSession in class ServerCnxnFactory

join

public void join()
          throws InterruptedException
Specified by:
join in class ServerCnxnFactory
Throws:
InterruptedException

getConnections

public Iterable<ServerCnxn> getConnections()
Specified by:
getConnections in class ServerCnxnFactory


Copyright © 2011 The Apache Software Foundation