Example usage for org.apache.zookeeper.server ZooKeeperThread ZooKeeperThread

List of usage examples for org.apache.zookeeper.server ZooKeeperThread ZooKeeperThread

Introduction

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

Prototype

public ZooKeeperThread(String threadName) 

Source Link

Usage

From source file:org.apache.manifoldcf.core.lockmanager.ZooKeeperInstance.java

License:Apache License

public void start() throws Exception {
    Properties startupProperties = new Properties();
    startupProperties.setProperty("tickTime", "2000");
    startupProperties.setProperty("dataDir", tempDir.toString());
    startupProperties.setProperty("clientPort", Integer.toString(zkPort));

    final QuorumPeerConfig quorumConfiguration = new QuorumPeerConfig();
    quorumConfiguration.parseProperties(startupProperties);

    final ServerConfig configuration = new ServerConfig();
    configuration.readFrom(quorumConfiguration);

    zookeeperThread = new ZooKeeperThread(configuration);
    zookeeperThread.start();//from  w ww . j  a v a  2s .c  o m
    // We have no way of knowing whether zookeeper is alive or not, but the
    // client is supposed to know about that.  But it doesn't, so wait for 5 seconds
    Thread.sleep(5000L);
}