當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。