Package org.apache.zookeeper.server.persistence

Examples of org.apache.zookeeper.server.persistence.FileTxnSnapLog


            public ZooKeeperServer createServer() throws IOException {
                // create a file logger url from the command line args
                ZooKeeperServer zks = new ZooKeeperServer();
                zks.setClientPort(ServerConfig.getClientPort());

               FileTxnSnapLog ftxn = new FileTxnSnapLog(new
                       File(ServerConfig.getDataLogDir()),
                        new File(ServerConfig.getDataDir()));
               zks.setTxnLogFactory(ftxn);
               return zks;
            }
View Full Code Here


     * test code.
     * It defaults to FileLogProvider persistence provider.
     */
    public ZooKeeperServer(File snapDir, File logDir, int tickTime)
            throws IOException {
        this(new FileTxnSnapLog(snapDir,logDir),
                tickTime,new BasicDataTreeBuilder());
    }
View Full Code Here

        this.electionType = electionType;
        this.myid = myid;
        this.tickTime = tickTime;
        this.initLimit = initLimit;
        this.syncLimit = syncLimit;       
        this.logFactory = new FileTxnSnapLog(dataLogDir, dataDir);
        if(quorumConfig == null)
            this.quorumConfig = new QuorumMaj(quorumPeers.size());
        else this.quorumConfig = quorumConfig;
    }
View Full Code Here

        if (!QuorumPeerConfig.isStandalone()) {
            runPeer(new QuorumPeer.Factory() {
                public QuorumPeer create(NIOServerCnxn.Factory cnxnFactory) throws IOException {
                    QuorumPeer peer = new QuorumPeer();
                    peer.setClientPort(ServerConfig.getClientPort());
                    peer.setTxnFactory(new FileTxnSnapLog(
                                new File(QuorumPeerConfig.getDataLogDir()),
                                new File(QuorumPeerConfig.getDataDir())));
                    peer.setQuorumPeers(QuorumPeerConfig.getServers());
                    peer.setElectionType(QuorumPeerConfig.getElectionAlg());
                    peer.setMyid(QuorumPeerConfig.getServerId());
View Full Code Here

          ServerCnxnFactory cnxnFactory = ServerCnxnFactory.createFactory();
          cnxnFactory.configure(config.getClientPortAddress(),
                                config.getMaxClientCnxns());

          quorumPeer = new QuorumPeer();
          quorumPeer.setTxnFactory(new FileTxnSnapLog(
                      config.getDataLogDir(),
                      config.getDataDir()));
          quorumPeer.enableLocalSessions(config.areLocalSessionsEnabled());
          quorumPeer.enableLocalSessionsUpgrading(
              config.isLocalSessionsUpgradingEnabled());
View Full Code Here

      File dataFile = new File(logdir, "zookeeper_data").getAbsoluteFile();
      File snapFile = new File(logdir, "zookeeper_snap").getAbsoluteFile();

      server = new ZooKeeperServer(
          new FileTxnSnapLog(dataFile, snapFile),
          new BasicDataTreeBuilder());

      connection = new NIOServerCnxnFactory();
      connection.configure(new InetSocketAddress(port), maxconnections);
      connection.startup(server);
View Full Code Here

  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());
View Full Code Here

     * test code.
     * It defaults to FileLogProvider persistence provider.
     */
    public ZooKeeperServer(File snapDir, File logDir, int tickTime)
            throws IOException {
        this( new FileTxnSnapLog(snapDir, logDir),
                tickTime, new BasicDataTreeBuilder());
    }
View Full Code Here

            runPeer(new QuorumPeer.Factory() {
                public QuorumPeer create(NIOServerCnxn.Factory cnxnFactory)
                throws IOException {
                    ManagedQuorumPeer peer = new ManagedQuorumPeer();
                    peer.setClientPort(ServerConfig.getClientPort());
                    FileTxnSnapLog factory = new FileTxnSnapLog(new
                            File(ServerConfig.getDataLogDir()), new 
                                    File(ServerConfig.getDataDir()));
                    peer.setTxnFactory(factory);
                    peer.setQuorumPeers(QuorumPeerConfig.getServers());
                    peer.setElectionType(QuorumPeerConfig.getElectionAlg());
View Full Code Here

            public NIOServerCnxn.Factory createConnectionFactory()throws IOException {
                return new ObservableNIOServerCnxn.Factory(getClientPort());
            }
            public ZooKeeperServer createServer() throws IOException {
                ManagedZooKeeperServer zks = new ManagedZooKeeperServer(
                        new FileTxnSnapLog(new File(ServerConfig.getDataDir()),
                        new File(ServerConfig.getDataLogDir())),
                new ZooKeeperServer.BasicDataTreeBuilder());
                return zks;
            }
        });
View Full Code Here

TOP

Related Classes of org.apache.zookeeper.server.persistence.FileTxnSnapLog

Copyright © 2018 www.massapicom. 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.