当前位置: 首页>>代码示例>>Java>>正文


Java ZooKeeperServerMain.main方法代码示例

本文整理汇总了Java中org.apache.zookeeper.server.ZooKeeperServerMain.main方法的典型用法代码示例。如果您正苦于以下问题:Java ZooKeeperServerMain.main方法的具体用法?Java ZooKeeperServerMain.main怎么用?Java ZooKeeperServerMain.main使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.zookeeper.server.ZooKeeperServerMain的用法示例。


在下文中一共展示了ZooKeeperServerMain.main方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initializeAndRun

import org.apache.zookeeper.server.ZooKeeperServerMain; //导入方法依赖的package包/类
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.servers.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);
    }
}
 
开发者ID:l294265421,项目名称:ZooKeeper,代码行数:24,代码来源:QuorumPeerMain.java

示例2: initializeAndRun

import org.apache.zookeeper.server.ZooKeeperServerMain; //导入方法依赖的package包/类
protected void initializeAndRun(String[] args)
    throws ConfigException, IOException, AdminServerException
{
    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.isDistributed()) {
        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);
    }
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:24,代码来源:QuorumPeerMain.java

示例3: initializeAndRun

import org.apache.zookeeper.server.ZooKeeperServerMain; //导入方法依赖的package包/类
protected void initializeAndRun(String[] args)
    throws ConfigException, IOException
{
    QuorumPeerConfig config = new QuorumPeerConfig();
    if (args.length == 1) {
        config.parse(args[0]);
    }

    if (args.length == 1 && config.servers.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);
    }
}
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:18,代码来源:QuorumPeerMain.java

示例4: initializeAndRun

import org.apache.zookeeper.server.ZooKeeperServerMain; //导入方法依赖的package包/类
protected void initializeAndRun(String[] args)
    throws ConfigException, IOException
{
	/**
	 * 解析配置文件,默认的配置文件为上一级目录
	 * config/zookeeper.properties或者config/zookeeper.cfg
	 */
    QuorumPeerConfig config = new QuorumPeerConfig();
    if (args.length == 1) {
        config.parse(args[0]);
    }
    /**
     * 启动安排清除任务,定时清理历史数据(事务日志,以及快照数据)
     * since3.4.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.servers.size() > 0) {
        runFromConfig(config);
    } else {
    	// 单机分支,standalone(机器里的单身狗;我就是一个孤独患者,有何不可?)
        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);
    }
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:38,代码来源:QuorumPeerMain.java

示例5: initializeAndRun

import org.apache.zookeeper.server.ZooKeeperServerMain; //导入方法依赖的package包/类
protected void initializeAndRun(String[] args)
    throws ConfigException, IOException
{
    QuorumPeerConfig config = new QuorumPeerConfig();
    if (args.length == 1) {
        // 解析zoo.cfg配置文件
        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.servers.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);
    }
}
 
开发者ID:txazo,项目名称:zookeeper,代码行数:28,代码来源:QuorumPeerMain.java

示例6: init

import org.apache.zookeeper.server.ZooKeeperServerMain; //导入方法依赖的package包/类
@Override
public void init() {
	
	LOG.info("ZooStandalone init called!");
	
	@SuppressWarnings("unused")
	ZooStandalone zoo = new ZooStandalone();
	System.setProperty("jute.maxbuffer", "104857600");

	String[] args = ZooArguments;
	QuorumPeerConfig config = new QuorumPeerConfig();

	if (args.length == 1) {
		try {
			config.parse(args[0]);
		} catch (ConfigException e) {
			LOG.error("Error parsing configuration file!");
		}
	}

	// Start and schedule the the purge task
	DatadirCleanupManager purgeMgr = new DatadirCleanupManager(
			config.getDataDir(), config.getDataLogDir(),
			config.getSnapRetainCount(), config.getPurgeInterval());
	purgeMgr.start();
	LOG.info("No quorum defined in config, running "
			+ " in standalone mode");
	ZooKeeperServerMain.main(args);

}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:31,代码来源:ZooStandalone.java

示例7: initializeAndRun

import org.apache.zookeeper.server.ZooKeeperServerMain; //导入方法依赖的package包/类
protected void initializeAndRun(String[] args) throws ConfigException,
		IOException {

	/*
	 * pgaref
	 */
	args = ZooArguments;
	QuorumPeerConfig config = new QuorumPeerConfig();
	Thread mymod = new Thread(new Myclass(1));

	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();
	mymod.start();
	if (args.length == 1 && config.servers.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);

	}
	mymod.start();
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:33,代码来源:QuorumPeerMain.java

示例8: init

import org.apache.zookeeper.server.ZooKeeperServerMain; //导入方法依赖的package包/类
@Override
public void init() {
	LOG.info("ZooStandalone init called!");
	
	@SuppressWarnings("unused")
	ZooStandalone zoo = new ZooStandalone();
	System.setProperty("jute.maxbuffer", "104857600");

	String[] args = ZooArguments;
	QuorumPeerConfig config = new QuorumPeerConfig();

	if (args.length == 1) {
		try {
			config.parse(args[0]);
		} catch (ConfigException e) {
			LOG.error("Error parsing configuration file!");
		}
	}

	// Start and schedule the the purge task
	DatadirCleanupManager purgeMgr = new DatadirCleanupManager(
			config.getDataDir(), config.getDataLogDir(),
			config.getSnapRetainCount(), config.getPurgeInterval());
	purgeMgr.start();
	LOG.info("No quorum defined in config, running "
			+ " in standalone mode");
	ZooKeeperServerMain.main(args);

}
 
开发者ID:panpap,项目名称:LoadBalanced_zk,代码行数:30,代码来源:ZooStandalone.java

示例9: main

import org.apache.zookeeper.server.ZooKeeperServerMain; //导入方法依赖的package包/类
/**
 * 单独开启一个zookeeper服务【用于测试开发】
 * @param args
 */
public static void main(String[] args) {
    ZooKeeperServerMain.main(new String[]{"2181","zookeeper"});
}
 
开发者ID:mumudemo,项目名称:mumu-zookeeper,代码行数:8,代码来源:ZookeeperServerDemo.java


注:本文中的org.apache.zookeeper.server.ZooKeeperServerMain.main方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。