Class NIOServerCnxnFactory

  • All Implemented Interfaces:
    java.lang.Runnable

    public class NIOServerCnxnFactory
    extends ServerCnxnFactory
    implements java.lang.Runnable
    • Constructor Detail

      • NIOServerCnxnFactory

        public NIOServerCnxnFactory()
                             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.
        Throws:
        java.io.IOException
    • Method Detail

      • configure

        public void configure​(java.net.InetSocketAddress addr,
                              int maxcc)
                       throws java.io.IOException
        Specified by:
        configure in class ServerCnxnFactory
        Throws:
        java.io.IOException
      • setMaxClientCnxnsPerHost

        public void setMaxClientCnxnsPerHost​(int max)
        Maximum number of connections allowed from particular host (ip)
        Specified by:
        setMaxClientCnxnsPerHost in class ServerCnxnFactory
      • startup

        public void startup​(ZooKeeperServer zks)
                     throws java.io.IOException,
                            java.lang.InterruptedException
        Specified by:
        startup in class ServerCnxnFactory
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • 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
      • closeAll

        public void closeAll()
        clear all the connections in the selector
        Specified by:
        closeAll in class ServerCnxnFactory
      • join

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