Package org.apache.zookeeper.server

Examples of org.apache.zookeeper.server.ServerConfig.readFrom()


    @Override
    public void runFromConfig(QuorumPeerConfig config) throws Exception
    {
        ServerConfig serverConfig = new ServerConfig();
        serverConfig.readFrom(config);
        latch.countDown();
        try
        {
            super.runFromConfig(serverConfig);
        }
View Full Code Here


          Properties zkProperties = generateLocalZkProperties();
          QuorumPeerConfig qpConfig = new QuorumPeerConfig();
          qpConfig.parseProperties(zkProperties);
          // run the zookeeper instance
          final ServerConfig zkConfig = new ServerConfig();
          zkConfig.readFrom(qpConfig);
          zookeeper.runFromConfig(zkConfig);
        } catch (QuorumPeerConfig.ConfigException qpcce) {
          throw new RuntimeException("parse of generated ZK config file " +
                                       "has failed.", qpcce);
        } catch (IOException e) {
View Full Code Here

   */
  private static boolean runZooKeeperAndJob(QuorumPeerConfig quorumPeerConfig,
                                            GiraphJob giraphJob) {
    final InternalZooKeeper zookeeper = new InternalZooKeeper();
    final ServerConfig zkConfig = new ServerConfig();
    zkConfig.readFrom(quorumPeerConfig);

    ExecutorService executorService = Executors.newSingleThreadExecutor();
    executorService.execute(new Runnable() {
      @Override
      public void run() {
View Full Code Here

        QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig();
        quorumPeerConfig.parseProperties(properties);

        zkServer = new ZooKeeperServerMain();
        ServerConfig configuration = new ServerConfig();
        configuration.readFrom(quorumPeerConfig);

        zkServer.runFromConfig(configuration);
      }
      catch (Exception e) {
        if (errorHandler != null) {
View Full Code Here

      throw new RuntimeException("This is impossible - no I/O to configure a quorumpeer from a properties object", e);
    }

    // don't ask me why ...
    ServerConfig config = new ServerConfig();
    config.readFrom(qpc);

    log.info("Starting embedded zookeeper server on port " + clientPort);
    ZooKeeperServer zooKeeperServer = new ZooKeeperServer();
    configure(zooKeeperServer, config);
View Full Code Here

        return peerConfig;
    }

    private ServerConfig getServerConfig(QuorumPeerConfig peerConfig) {
        ServerConfig serverConfig = new ServerConfig();
        serverConfig.readFrom(peerConfig);
        LOGGER.info("Created zookeeper server configuration: {}", serverConfig);
        return serverConfig;
    }

View Full Code Here

        return peerConfig;
    }

    private static ServerConfig getServerConfig(QuorumPeerConfig peerConfig) {
        ServerConfig serverConfig = new ServerConfig();
        serverConfig.readFrom(peerConfig);
        LOGGER.info("Created zookeeper server configuration: {}", serverConfig);
        return serverConfig;
    }

    private static class SimpleServer {
View Full Code Here

                                  quorumConfig.getSnapRetainCount(),
                                  quorumConfig.getPurgeInterval());
    purgeManager.start();

    ServerConfig serverConfig = new ServerConfig();
    serverConfig.readFrom(quorumConfig);

    zkServer = new ZooKeeperServer();
    zkServer.setTickTime(serverConfig.getTickTime());
    zkServer.setMinSessionTimeout(serverConfig.getMinSessionTimeout());
    zkServer.setMaxSessionTimeout(serverConfig.getMaxSessionTimeout());
View Full Code Here

      final QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig();
      quorumPeerConfig.parse(conf.getConfFile());
      QuorumPeer.Factory qpFactory = new QuorumPeer.Factory() {
        public QuorumPeer create(NIOServerCnxn.Factory cnxnFactory) throws IOException {
          ServerConfig serverConfig = new ServerConfig();
          serverConfig.readFrom(quorumPeerConfig);
          QuorumPeer peer = new QuorumPeer(quorumPeerConfig.getServers(), new File(serverConfig.getDataDir()), new File(
              serverConfig.getDataLogDir()), quorumPeerConfig.getElectionAlg(), quorumPeerConfig.getServerId(),
              quorumPeerConfig.getTickTime(), quorumPeerConfig.getInitLimit(), quorumPeerConfig.getSyncLimit(), cnxnFactory,
              quorumPeerConfig.getQuorumVerifier());
          ZooDiscoveryContainer.this.quorumPeer = peer;
View Full Code Here

      public void run() {
        if (standalone) {
          this.setName("ZooKeeper standalone thread");

          LOG.info("Starting ZooKeeper server");
          serverConfig.readFrom(config);
          try {
            zkServerMain.runFromConfig(serverConfig);
          } catch (IOException e) {
            LOG.error("Couldn't start ZooKeeper server!", e);
          }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.