Example usage for org.apache.zookeeper.server ZooKeeperServerMain main

List of usage examples for org.apache.zookeeper.server ZooKeeperServerMain main

Introduction

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

Prototype

public static void main(String[] args) 

Source Link

Usage

From source file:com.chiralBehaviors.autoconfigure.ZookeeperLauncher.java

License:Open Source License

/**
 * Copied from QuorumPeerMain because whomever wrote that crap made things
 * protected. Because freedom./*from  w ww . j  av a 2  s  .c  om*/
 */
protected void initializeAndRun(String[] args) throws ConfigException, IOException {
    QuorumPeerConfig config = new QuorumPeerConfig();
    if (args.length == 1) {
        config.parse(args[0]);
    }

    // Start and schedule the the purge task
    DatadirCleanupManager purgeMgr = new DatadirCleanupManager(config.getDataDir(), config.getDataLogDir(),
            config.getSnapRetainCount(), config.getPurgeInterval());
    purgeMgr.start();

    if (args.length == 1 && config.getServers().size() > 0) {
        runFromConfig(config);
    } else {
        LOG.warning("Running in standalone mode");
        // there is only server in the quorum -- run as standalone
        ZooKeeperServerMain.main(args);
    }
}

From source file:com.glaf.cluster.catalina.session.QuorumPeerMain.java

License:Apache License

protected void initializeAndRun(String[] args) throws ConfigException, IOException {
    QuorumPeerConfig config = new QuorumPeerConfig();
    if (args.length == 1) {
        config.parse(args[0]);//from www.j  a  v a2s .  c  o  m
    }

    // Start and schedule the the purge task
    DatadirCleanupManager purgeMgr = new DatadirCleanupManager(config.getDataDir(), config.getDataLogDir(),
            config.getSnapRetainCount(), config.getPurgeInterval());
    purgeMgr.start();

    if (args.length == 1 && config.getServers().size() > 0) {
        runFromConfig(config);
    } else {
        LOG.warn("Either no config or no quorum defined in config, running " + " in standalone mode");
        // there is only server in the quorum -- run as standalone
        ZooKeeperServerMain.main(args);
    }
}

From source file:com.yahoo.pasc.paxos.PaxosEnsemble.java

License:Open Source License

private static void startZK() throws IOException {
    final File zkTmpDir = File.createTempFile("zookeeper", "test");
    zkTmpDir.delete();/*  ww w. j ava  2  s.co  m*/
    zkTmpDir.mkdir();

    new Thread() {
        @Override
        public void run() {
            ZooKeeperServerMain.main(new String[] { "2181", zkTmpDir.getAbsolutePath() });
        }
    }.start();

    try {
        Thread.sleep(1000);
    } catch (InterruptedException e) {
    }
}