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


Java ServerConfig.getDataLogDir方法代码示例

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


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

示例1: createAndStartZooKeeper

import org.apache.zookeeper.server.ServerConfig; //导入方法依赖的package包/类
public static void createAndStartZooKeeper() 
  throws IOException, ConfigException, InterruptedException {
  logStateChange("Creating zookeeper server");
  AvatarShell.retrySleep = 1000;
  ServerConfig zkConf = createZooKeeperConf();

  zooKeeper = new ZooKeeperServer();
  FileTxnSnapLog ftxn = new 
    FileTxnSnapLog(new File(zkConf.getDataLogDir()),
                   new File(zkConf.getDataDir()));
  zooKeeper.setTxnLogFactory(ftxn);
  zooKeeper.setTickTime(zkConf.getTickTime());
  zooKeeper.setMinSessionTimeout(zkConf.getMinSessionTimeout());
  zooKeeper.setMaxSessionTimeout(zkConf.getMaxSessionTimeout());

  cnxnFactory = new NIOServerCnxnFactory();
  cnxnFactory.configure(zkConf.getClientPortAddress(),
      zkConf.getMaxClientCnxns());
  cnxnFactory.startup(zooKeeper);
  logStateChange("Creating zookeeper server - completed");
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:22,代码来源:MiniAvatarCluster.java

示例2: runFromConfig

import org.apache.zookeeper.server.ServerConfig; //导入方法依赖的package包/类
private void runFromConfig(ServerConfig config) throws IOException {
    zkServer = new ZooKeeperServer();
    try {

        txnLog = new FileTxnSnapLog(new File(config.getDataLogDir()), new File(config.getDataDir()));
        zkServer.setTxnLogFactory(txnLog);
        zkServer.setTickTime(config.getTickTime());
        zkServer.setMinSessionTimeout(config.getMinSessionTimeout());
        zkServer.setMaxSessionTimeout(config.getMaxSessionTimeout());
        cnxnFactory = ServerCnxnFactory.createFactory();
        cnxnFactory.configure(config.getClientPortAddress(),
                config.getMaxClientCnxns());
        cnxnFactory.startup(zkServer);
    } catch (InterruptedException e) {
        if (zkServer.isRunning()) {
            zkServer.shutdown();
        }
    }
}
 
开发者ID:intropro,项目名称:prairie,代码行数:20,代码来源:ZookeeperUnit.java

示例3: createAndStartZooKeeper

import org.apache.zookeeper.server.ServerConfig; //导入方法依赖的package包/类
public static void createAndStartZooKeeper() 
  throws IOException, ConfigException, InterruptedException {
  ServerConfig zkConf = createZooKeeperConf();

  zooKeeper = new ZooKeeperServer();
  FileTxnSnapLog ftxn = new 
    FileTxnSnapLog(new File(zkConf.getDataLogDir()),
                   new File(zkConf.getDataDir()));
  zooKeeper.setTxnLogFactory(ftxn);
  zooKeeper.setTickTime(zkConf.getTickTime());
  zooKeeper.setMinSessionTimeout(zkConf.getMinSessionTimeout());
  zooKeeper.setMaxSessionTimeout(zkConf.getMaxSessionTimeout());

  cnxnFactory =
    new NIOServerCnxn.Factory(zkConf.getClientPortAddress(),
                              zkConf.getMaxClientCnxns());
  cnxnFactory.startup(zooKeeper);

}
 
开发者ID:iVCE,项目名称:RDFS,代码行数:20,代码来源:MiniAvatarCluster.java

示例4: runFromConfig

import org.apache.zookeeper.server.ServerConfig; //导入方法依赖的package包/类
/**
     * Run from a ServerConfig.
     * @param config ServerConfig to use.
     * @throws IOException on any error
     */
    public void runFromConfig(ServerConfig config) throws IOException {
    	LOG.info(">>>>> Starting Test ZooKeep Server...");
        FileTxnSnapLog txnLog = null;
        try {
            // Note that this thread isn't going to be doing anything else,
            // so rather than spawning another thread, we will just call
            // run() in this thread.
            // create a file logger url from the command line args
            zkServer = new ZooKeeperServer();

            txnLog = new FileTxnSnapLog(new File(config.getDataLogDir()), new File(
                    config.getDataDir()));
            zkServer.setTxnLogFactory(txnLog);
            zkServer.setTickTime(config.getTickTime());
            zkServer.setMinSessionTimeout(config.getMinSessionTimeout());
            zkServer.setMaxSessionTimeout(config.getMaxSessionTimeout());
            cnxnFactory = ServerCnxnFactory.createFactory();
            cnxnFactory.configure(config.getClientPortAddress(),
                    config.getMaxClientCnxns());
            cnxnFactory.startup(zkServer);
            LOG.info("<<<<< Test ZooKeep Server Started.");
//            cnxnFactory.join();
//            if (zkServer.isRunning()) {
//                zkServer.shutdown();
//            }            
        } catch (InterruptedException e) {
            // warn, but generally this is ok
            LOG.warn("Server interrupted", e);
        } finally {
//            if (txnLog != null) {
//                txnLog.close();
//            }
        }
    }
 
开发者ID:nickman,项目名称:HeliosStreams,代码行数:40,代码来源:TestZooKeeperServer.java

示例5: runFromConfig

import org.apache.zookeeper.server.ServerConfig; //导入方法依赖的package包/类
/**
 * Run from a ServerConfig.
 * @param config ServerConfig to use.
 * @throws IOException If there is a low-level I/O error.
 */
public void runFromConfig(ServerConfig config) throws IOException {
  log.info("Starting server");
  try {
    // Note that this thread isn't going to be doing anything else,
    // so rather than spawning another thread, we will just call
    // run() in this thread.
    // create a file logger url from the command line args
    zooKeeperServer = new ZooKeeperServer();
    
    FileTxnSnapLog ftxn = new FileTxnSnapLog(new File(
        config.getDataLogDir()), new File(config.getDataDir()));
    zooKeeperServer.setTxnLogFactory(ftxn);
    zooKeeperServer.setTickTime(config.getTickTime());
    zooKeeperServer.setMinSessionTimeout(config.getMinSessionTimeout());
    zooKeeperServer.setMaxSessionTimeout(config.getMaxSessionTimeout());
    cnxnFactory = ServerCnxnFactory.createFactory();
    cnxnFactory.configure(config.getClientPortAddress(),
        config.getMaxClientCnxns());
    cnxnFactory.startup(zooKeeperServer);
    cnxnFactory.join();
   // if (zooKeeperServer.isRunning()) {
      zkServer.shutdown();
   // }
  } catch (InterruptedException e) {
    // warn, but generally this is ok
    log.warn("Server interrupted", e);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:34,代码来源:ZkTestServer.java

示例6: ZooKeeperServerFactory

import org.apache.zookeeper.server.ServerConfig; //导入方法依赖的package包/类
public ZooKeeperServerFactory(QuorumPeerConfig config) throws IOException, InterruptedException {
    LOGGER.info("Creating zookeeper server with: {}", config);
    ServerConfig serverConfig = getServerConfig(config);
    ZooKeeperServer zkServer = new ZooKeeperServer();
    FileTxnSnapLog ftxn = new FileTxnSnapLog(new File(serverConfig.getDataLogDir()), new File(serverConfig.getDataDir()));
    zkServer.setTxnLogFactory(ftxn);
    zkServer.setTickTime(serverConfig.getTickTime());
    zkServer.setMinSessionTimeout(serverConfig.getMinSessionTimeout());
    zkServer.setMaxSessionTimeout(serverConfig.getMaxSessionTimeout());
    NIOServerCnxnFactory cnxnFactory = new NIOServerCnxnFactory() {
        protected void configureSaslLogin() throws IOException {
        }
    };
    InetSocketAddress clientPortAddress = serverConfig.getClientPortAddress();
    cnxnFactory.configure(clientPortAddress, serverConfig.getMaxClientCnxns());
    updateZooKeeperURL(cnxnFactory.getLocalAddress(), cnxnFactory.getLocalPort());

    try {
        LOGGER.debug("Starting ZooKeeper server on address %s", serverConfig.getClientPortAddress());
        cnxnFactory.startup(zkServer);
        LOGGER.debug("Started ZooKeeper server");
    } catch (Exception e) {
        LOGGER.warn(String.format("Failed to start ZooKeeper server, reason : %s", e));
        cnxnFactory.shutdown();
        throw e;
    }
}
 
开发者ID:fabric8io,项目名称:jube,代码行数:28,代码来源:ZooKeeperServerFactory.java

示例7: start

import org.apache.zookeeper.server.ServerConfig; //导入方法依赖的package包/类
/**
 * Starts the test ZooKeeper server
 */
public void start() {
  if (started) {
    LOG.debug("Already started");
    return;
  }
  try {
    LOG.debug("Starting...");
    ServerConfig config = new ServerConfig();
    config.parse(new String[] { port.toString(), ZK_DIR.getCanonicalPath(), ticktime.toString() });

    zkServer = new ZooKeeperServer();

    FileTxnSnapLog ftxn = new FileTxnSnapLog(new File(config.getDataLogDir()), new File(config.getDataDir()));
    zkServer.setTxnLogFactory(ftxn);
    zkServer.setTickTime(config.getTickTime());
    zkServer.setMinSessionTimeout(config.getMinSessionTimeout());
    zkServer.setMaxSessionTimeout(config.getMaxSessionTimeout());

    cnxnFactory = ServerCnxnFactory.createFactory();
    cnxnFactory.configure(config.getClientPortAddress(), config.getMaxClientCnxns());
    cnxnFactory.startup(zkServer);
    started = true;
    LOG.info("Started, {}", getConnectString());
  } catch (Exception e) {
    LOG.error("Failed to start: " + e.getMessage(), e);
  }
}
 
开发者ID:Comcast,项目名称:flume2storm,代码行数:31,代码来源:ZkTestServer.java

示例8: runFromConfig

import org.apache.zookeeper.server.ServerConfig; //导入方法依赖的package包/类
/**
 * Run from a ServerConfig.
 * @param config ServerConfig to use.
 * @throws IOException If there is a low-level I/O error.
 */
public void runFromConfig(ServerConfig config) throws IOException {
  log.info("Starting server");
  try {
    // Note that this thread isn't going to be doing anything else,
    // so rather than spawning another thread, we will just call
    // run() in this thread.
    // create a file logger url from the command line args
    zooKeeperServer = new ZooKeeperServer();
    
    FileTxnSnapLog ftxn = new FileTxnSnapLog(new File(
        config.getDataLogDir()), new File(config.getDataDir()));
    zooKeeperServer.setTxnLogFactory(ftxn);
    zooKeeperServer.setTickTime(config.getTickTime());
    zooKeeperServer.setMinSessionTimeout(config.getMinSessionTimeout());
    zooKeeperServer.setMaxSessionTimeout(config.getMaxSessionTimeout());
    cnxnFactory = ServerCnxnFactory.createFactory();
    cnxnFactory.configure(config.getClientPortAddress(),
        config.getMaxClientCnxns());
    cnxnFactory.startup(zooKeeperServer);
    cnxnFactory.join();
    if (zooKeeperServer.isRunning()) {
      zkServer.shutdown();
    }
  } catch (InterruptedException e) {
    // warn, but generally this is ok
    log.warn("Server interrupted", e);
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:34,代码来源:ZkTestServer.java

示例9: clearZooKeeperData

import org.apache.zookeeper.server.ServerConfig; //导入方法依赖的package包/类
public static boolean clearZooKeeperData() throws Exception {
  ServerConfig zkConf = getZooKeeperConf();
  File dataLogDir = new File(zkConf.getDataLogDir());
  File dataDir = new File(zkConf.getDataDir());
  return (FileUtil.fullyDelete(dataLogDir) && FileUtil.fullyDelete(dataDir));
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:7,代码来源:MiniAvatarCluster.java

示例10: runFromConfig

import org.apache.zookeeper.server.ServerConfig; //导入方法依赖的package包/类
@Override
public void runFromConfig(final ServerConfig config) throws IOException {
  ServerConfig newServerConfig = new ServerConfig() {

    public void parse(String[] args) {
      config.parse(args);
    }

    public void parse(String path)
        throws QuorumPeerConfig.ConfigException {
      config.parse(path);
    }

    public void readFrom(QuorumPeerConfig otherConfig) {
      config.readFrom(otherConfig);
    }

    public InetSocketAddress getClientPortAddress() {
      return config.getClientPortAddress();
    }

    public String getDataDir() {
      return config.getDataDir();
    }

    public String getDataLogDir() {
      return config.getDataLogDir();
    }

    public int getTickTime() {
      return config.getTickTime();
    }

    public int getMaxClientCnxns() {
      dataDir = getDataDir();
      dataLogDir = getDataLogDir();
      tickTime = getTickTime();
      minSessionTimeout = getMinSessionTimeout();
      maxSessionTimeout = getMaxSessionTimeout();
      maxClientCnxns = 0;
      return 0;
    }

    public int getMinSessionTimeout() {
      return config.getMinSessionTimeout();
    }

    public int getMaxSessionTimeout() {
      return config.getMaxSessionTimeout();
    }
  };

  newServerConfig.getMaxClientCnxns();

  super.runFromConfig(newServerConfig);
}
 
开发者ID:linkedin,项目名称:pinot,代码行数:57,代码来源:ZkStarter.java


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