Example usage for org.apache.zookeeper.server ZooKeeperServer dumpConf

List of usage examples for org.apache.zookeeper.server ZooKeeperServer dumpConf

Introduction

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

Prototype

public void dumpConf(PrintWriter pwriter) 

Source Link

Usage

From source file:org.apache.hadoop.registry.server.services.MicroZookeeperService.java

License:Apache License

/**
 * Startup: start ZK. It is only after this that
 * the binding information is valid.//from  w  ww .  ja  v  a 2  s  .co  m
 * @throws Exception
 */
@Override
protected void serviceStart() throws Exception {

    setupSecurity();

    ZooKeeperServer zkServer = new ZooKeeperServer();
    FileTxnSnapLog ftxn = new FileTxnSnapLog(dataDir, dataDir);
    zkServer.setTxnLogFactory(ftxn);
    zkServer.setTickTime(tickTime);

    LOG.info("Starting Local Zookeeper service");
    factory = ServerCnxnFactory.createFactory();
    factory.configure(getAddress(port), -1);
    factory.startup(zkServer);

    String connectString = getConnectionString();
    LOG.info("In memory ZK started at {}\n", connectString);

    if (LOG.isDebugEnabled()) {
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        zkServer.dumpConf(pw);
        pw.flush();
        LOG.debug(sw.toString());
    }
    binding = new BindingInformation();
    binding.ensembleProvider = new FixedEnsembleProvider(connectString);
    binding.description = getName() + " reachable at \"" + connectString + "\"";

    addDiagnostics(binding.description);
    // finally: set the binding information in the config
    getConfig().set(KEY_REGISTRY_ZK_QUORUM, connectString);
}