Example usage for org.apache.zookeeper ZooKeeper ZooKeeper

List of usage examples for org.apache.zookeeper ZooKeeper ZooKeeper

Introduction

In this page you can find the example usage for org.apache.zookeeper ZooKeeper ZooKeeper.

Prototype

public ZooKeeper(String connectString, int sessionTimeout, Watcher watcher, long sessionId,
        byte[] sessionPasswd, boolean canBeReadOnly) throws IOException 

Source Link

Document

To create a ZooKeeper client object, the application needs to pass a connection string containing a comma separated list of host:port pairs, each corresponding to a ZooKeeper server.

Usage

From source file:com.ebay.jetstream.messaging.transport.zookeeper.ZooKeeperFactory.java

License:MIT License

@Override
public ZooKeeper newZooKeeper(String connectString, int sessionTimeout, Watcher watcher, boolean canBeReadOnly)
        throws Exception {
    if (sessionId != null && sessionPwd.length > 0) {
        return new ZooKeeper(connectString, sessionTimeout, watcher, sessionId, sessionPwd, canBeReadOnly);
    } else {//from   w ww.j av  a 2s  .  co m
        return new ZooKeeper(connectString, sessionTimeout, watcher, canBeReadOnly);
    }
}