gpt4 book ai didi

org.apache.zookeeper.server.ZooKeeperServer.setTickTime()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 04:34:40 26 4
gpt4 key购买 nike

本文整理了Java中org.apache.zookeeper.server.ZooKeeperServer.setTickTime()方法的一些代码示例,展示了ZooKeeperServer.setTickTime()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperServer.setTickTime()方法的具体详情如下:
包路径:org.apache.zookeeper.server.ZooKeeperServer
类名称:ZooKeeperServer
方法名:setTickTime

ZooKeeperServer.setTickTime介绍

暂无

代码示例

代码示例来源:origin: apache/zookeeper

public void setTickTime(int tickTime) {
  zks.setTickTime(tickTime);
}

代码示例来源:origin: org.apache.zookeeper/zookeeper

public void setTickTime(int tickTime) {
  zks.setTickTime(tickTime);
}

代码示例来源:origin: apache/nifi

private void startStandalone() throws IOException {
  logger.info("Starting Embedded ZooKeeper Server");
  final ServerConfig config = new ServerConfig();
  config.readFrom(quorumPeerConfig);
  try {
    transactionLog = new FileTxnSnapLog(new File(config.getDataLogDir()), new File(config.getDataDir()));
    embeddedZkServer = new ZooKeeperServer();
    embeddedZkServer.setTxnLogFactory(transactionLog);
    embeddedZkServer.setTickTime(config.getTickTime());
    embeddedZkServer.setMinSessionTimeout(config.getMinSessionTimeout());
    embeddedZkServer.setMaxSessionTimeout(config.getMaxSessionTimeout());
    connectionFactory = ServerCnxnFactory.createFactory();
    connectionFactory.configure(config.getClientPortAddress(), config.getMaxClientCnxns());
    connectionFactory.startup(embeddedZkServer);
  } catch (InterruptedException e) {
    Thread.currentThread().interrupt();
    logger.warn("Embedded ZooKeeper Server interrupted", e);
  } catch (final IOException ioe) {
    throw new IOException("Failed to start embedded ZooKeeper Server", ioe);
  } catch (final Exception e) {
    throw new RuntimeException("Failed to start embedded ZooKeeper Server", e);
  }
}

代码示例来源:origin: org.apache.zookeeper/zookeeper

txnLog.setServerStats(zkServer.serverStats());
zkServer.setTxnLogFactory(txnLog);
zkServer.setTickTime(config.tickTime);
zkServer.setMinSessionTimeout(config.minSessionTimeout);
zkServer.setMaxSessionTimeout(config.maxSessionTimeout);

代码示例来源:origin: OryxProject/oryx

zkServer.setTickTime(serverConfig.getTickTime());
zkServer.setMinSessionTimeout(serverConfig.getMinSessionTimeout());
zkServer.setMaxSessionTimeout(serverConfig.getMaxSessionTimeout());

代码示例来源:origin: org.apache.hadoop/zookeeper

public void setTickTime(int tickTime) {
  zks.setTickTime(tickTime);
}

代码示例来源:origin: org.wildfly.camel/wildfly-camel-itests-common

public EmbeddedZookeeper(int port, Path baseDir) throws Exception {
  this.port = port;
  zookeeperBaseDir = baseDir;
  zkServer = new ZooKeeperServer();
  File dataDir = zookeeperBaseDir.resolve("log").toFile();
  File snapDir = zookeeperBaseDir.resolve("data").toFile();
  FileTxnSnapLog ftxn = new FileTxnSnapLog(dataDir, snapDir);
  zkServer.setTxnLogFactory(ftxn);
  zkServer.setTickTime(1000);
  connectionFactory = new NIOServerCnxnFactory() {
    @Override
    protected void configureSaslLogin() throws IOException {
      // do nothing
    }
  };
  connectionFactory.configure(new InetSocketAddress("localhost", port), 0);
}

代码示例来源:origin: wildfly-extras/wildfly-camel

public EmbeddedZookeeper(int port, Path baseDir) throws Exception {
  this.port = port;
  zookeeperBaseDir = baseDir;
  zkServer = new ZooKeeperServer();
  File dataDir = zookeeperBaseDir.resolve("log").toFile();
  File snapDir = zookeeperBaseDir.resolve("data").toFile();
  FileTxnSnapLog ftxn = new FileTxnSnapLog(dataDir, snapDir);
  zkServer.setTxnLogFactory(ftxn);
  zkServer.setTickTime(1000);
  connectionFactory = new NIOServerCnxnFactory() {
    @Override
    protected void configureSaslLogin() throws IOException {
      // do nothing
    }
  };
  connectionFactory.configure(new InetSocketAddress("localhost", port), 0);
}

代码示例来源:origin: Cue/greplin-zookeeper-utils

private void configure(ZooKeeperServer zooKeeperServer, ServerConfig config) throws IOException {
 zooKeeperServer.setTxnLogFactory(
   new FileTxnSnapLog(new File(config.getDataLogDir()), new File(config.getDataDir())));
 zooKeeperServer.setTickTime(config.getTickTime());
 zooKeeperServer.setMinSessionTimeout(config.getMinSessionTimeout());
 zooKeeperServer.setMaxSessionTimeout(config.getMaxSessionTimeout());
}

代码示例来源:origin: org.apache.twill/twill-zookeeper

@Override
protected void startUp() throws Exception {
 ZooKeeperServer zkServer = new ZooKeeperServer();
 FileTxnSnapLog ftxn = new FileTxnSnapLog(dataDir, dataDir);
 zkServer.setTxnLogFactory(ftxn);
 zkServer.setTickTime(tickTime);
 factory = ServerCnxnFactory.createFactory();
 factory.configure(getAddress(port), -1);
 factory.startup(zkServer);
 LOG.info("In memory ZK started: " + getConnectionStr());
}

代码示例来源:origin: apache/twill

@Override
protected void startUp() throws Exception {
 ZooKeeperServer zkServer = new ZooKeeperServer();
 FileTxnSnapLog ftxn = new FileTxnSnapLog(dataDir, dataDir);
 zkServer.setTxnLogFactory(ftxn);
 zkServer.setTickTime(tickTime);
 factory = ServerCnxnFactory.createFactory();
 factory.configure(getAddress(port), -1);
 factory.startup(zkServer);
 LOG.info("In memory ZK started: " + getConnectionStr());
}

代码示例来源:origin: io.hops/hadoop-yarn-registry

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

代码示例来源:origin: org.apache.giraph/giraph-core

/**
 * Run from a ServerConfig.
 * @param config ServerConfig to use.
 * @throws IOException
 */
public void runFromConfig(ZookeeperConfig 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
  zkServer = new ZooKeeperServer();
  FileTxnSnapLog ftxn = new FileTxnSnapLog(new
    File(config.getDataLogDir()), new File(config.getDataDir()));
  zkServer.setTxnLogFactory(ftxn);
  zkServer.setTickTime(GiraphConstants.DEFAULT_ZOOKEEPER_TICK_TIME);
  zkServer.setMinSessionTimeout(config.getMinSessionTimeout());
  zkServer.setMaxSessionTimeout(config.getMaxSessionTimeout());
  cnxnFactory = ServerCnxnFactory.createFactory();
  cnxnFactory.configure(config.getClientPortAddress(),
    GiraphConstants.DEFAULT_ZOOKEEPER_MAX_CLIENT_CNXNS);
  cnxnFactory.startup(zkServer);
 } catch (InterruptedException e) {
  // warn, but generally this is ok
  LOG.warn("Server interrupted", e);
 }
}

代码示例来源:origin: org.pongasoft/org.linkedin.zookeeper-impl

/**
 * This method is coming from <code>ZooKeeperServerMain</code> but tweaked to not block and to
 * have access to <code>_zkServer</code> and <code>_cnxnFactory</code>.
 */
private void runFromConfig(ServerConfig config) throws IOException
{
 log.info("Starting server");
 try
 {
  _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 = new NIOServerCnxnFactory();
  _cnxnFactory.configure(config.getClientPortAddress(), config.getMaxClientCnxns());
                      
  _cnxnFactory.startup(_zkServer);
 }
 catch(InterruptedException e)
 {
  // warn, but generally this is ok
  log.warn("Server interrupted", e);
 }
}

代码示例来源:origin: fabric8io/jube

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;
  }
}

代码示例来源:origin: co.paralleluniverse/galaxy

public static ServerCnxnFactory startZookeeper(final String configResource, final String dataDirName) throws IOException, QuorumPeerConfig.ConfigException {
  ServerConfig sc = new ServerConfig();
  sc.parse(pathToResource(configResource));
  deleteDir(dataDirName);
  new File(dataDirName).mkdirs();
  FileTxnSnapLog txnLog = null;
  try {
    ZooKeeperServer zkServer = new ZooKeeperServer();
    txnLog = new FileTxnSnapLog(new File(sc.getDataDir()), new File(
        sc.getDataDir()));
    zkServer.setTxnLogFactory(txnLog);
    zkServer.setTickTime(sc.getTickTime());
    zkServer.setMinSessionTimeout(sc.getMinSessionTimeout());
    zkServer.setMaxSessionTimeout(sc.getMaxSessionTimeout());
    ServerCnxnFactory cnxnFactory = ServerCnxnFactory.createFactory();
    cnxnFactory.configure(sc.getClientPortAddress(),
        sc.getMaxClientCnxns());
    cnxnFactory.startup(zkServer);
    return cnxnFactory;
  } catch (InterruptedException e) {
    throw new RuntimeException(e);
  } finally {
    if (txnLog != null) {
      txnLog.close();
    }
  }
}

代码示例来源:origin: com.intropro.prairie/zookeeper-unit

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();
    }
  }
}

代码示例来源:origin: org.fusesource.fabric/fabric-zookeeper-spring

public void afterPropertiesSet() throws Exception {
  if( purge ) {
    deleteFilesInDir(getDataLogDir());
    deleteFilesInDir(getDataDir());
  }
  FileTxnSnapLog ftxn = new FileTxnSnapLog(getDataLogDir(), getDataDir());
  zooKeeperServer.setTxnLogFactory(ftxn);
  zooKeeperServer.setTickTime(getTickTime());
  zooKeeperServer.setMinSessionTimeout(getMinSessionTimeout());
  zooKeeperServer.setMaxSessionTimeout(getMaxSessionTimeout());
  connectionFactory = new NIOServerCnxnFactory();
  connectionFactory.configure(getClientPortAddress(), getMaxClientConnections());
  connectionFactory.startup(zooKeeperServer);
}

代码示例来源:origin: io.fabric8/fabric-zookeeper-spring

public void afterPropertiesSet() throws Exception {
  if( purge ) {
    deleteFilesInDir(getDataLogDir());
    deleteFilesInDir(getDataDir());
  }
  FileTxnSnapLog ftxn = new FileTxnSnapLog(getDataLogDir(), getDataDir());
  zooKeeperServer.setTxnLogFactory(ftxn);
  zooKeeperServer.setTickTime(getTickTime());
  zooKeeperServer.setMinSessionTimeout(getMinSessionTimeout());
  zooKeeperServer.setMaxSessionTimeout(getMaxSessionTimeout());
  connectionFactory = new NIOServerCnxnFactory();
  connectionFactory.configure(getClientPortAddress(), getMaxClientConnections());
  connectionFactory.startup(zooKeeperServer);
}

代码示例来源:origin: jboss-fuse/fabric8

public void afterPropertiesSet() throws Exception {
  if( purge ) {
    deleteFilesInDir(getDataLogDir());
    deleteFilesInDir(getDataDir());
  }
  FileTxnSnapLog ftxn = new FileTxnSnapLog(getDataLogDir(), getDataDir());
  zooKeeperServer.setTxnLogFactory(ftxn);
  zooKeeperServer.setTickTime(getTickTime());
  zooKeeperServer.setMinSessionTimeout(getMinSessionTimeout());
  zooKeeperServer.setMaxSessionTimeout(getMaxSessionTimeout());
  connectionFactory = new NIOServerCnxnFactory();
  connectionFactory.configure(getClientPortAddress(), getMaxClientConnections());
  connectionFactory.startup(zooKeeperServer);
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com