Example usage for org.apache.zookeeper.server NIOServerCnxnFactory setMaxClientCnxnsPerHost

List of usage examples for org.apache.zookeeper.server NIOServerCnxnFactory setMaxClientCnxnsPerHost

Introduction

In this page you can find the example usage for org.apache.zookeeper.server NIOServerCnxnFactory setMaxClientCnxnsPerHost.

Prototype

public void setMaxClientCnxnsPerHost(int max) 

Source Link

Usage

From source file:org.deeplearning4j.scaleout.zookeeper.ZooKeeperRunner.java

License:Apache License

public void run() throws Exception {

    File dir = new File(dataDirectory, "zookeeper").getAbsoluteFile();
    NIOServerCnxnFactory factory = new NIOServerCnxnFactory();

    ZooKeeperServer server = new ZooKeeperServer(dir, dir, tickTime);

    factory.setZooKeeperServer(server);//from   w  w  w  .  j  ava 2 s  .  c o m
    factory.setMaxClientCnxnsPerHost(numConnections);
    factory.configure(new InetSocketAddress(clientPort), numConnections);
    factory.startup(server);

}