欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

zk中ZooKeeperServer的作用是什么

zk中ZooKeeperServer的作用是什么,針對這個問題,這篇文章詳細(xì)介紹了相對應(yīng)的分析和解答,希望可以幫助更多想解決這個問題的小伙伴找到更簡單易行的方法。

創(chuàng)新互聯(lián)專注為客戶提供全方位的互聯(lián)網(wǎng)綜合服務(wù),包含不限于成都網(wǎng)站設(shè)計(jì)、網(wǎng)站制作、東山網(wǎng)絡(luò)推廣、小程序制作、東山網(wǎng)絡(luò)營銷、東山企業(yè)策劃、東山品牌公關(guān)、搜索引擎seo、人物專訪、企業(yè)宣傳片、企業(yè)代運(yùn)營等,從售前售中售后,我們都將竭誠為您服務(wù),您的肯定,是我們最大的嘉獎;創(chuàng)新互聯(lián)為所有大學(xué)生創(chuàng)業(yè)者提供東山建站搭建服務(wù),24小時服務(wù)熱線:18980820575,官方網(wǎng)址:aaarwkj.com

內(nèi)部類

zk中ZooKeeperServer的作用是什么

ChangeRecord 處理PrepRP和FinalRP之間的信息

static class ChangeRecord {

    ChangeRecord(long zxid, String path, StatPersisted stat, int childCount, List<ACL> acl) {
        this.zxid = zxid;
        this.path = path;
        this.stat = stat;
        this.childCount = childCount;
        this.acl = acl;
    }

    long zxid;

    String path;

    StatPersisted stat; /* Make sure to create a new object when changing */

    int childCount;

    List<ACL> acl; /* Make sure to create a new object when changing */

    ChangeRecord duplicate(long zxid) {
        StatPersisted stat = new StatPersisted();
        if (this.stat != null) {
            DataTree.copyStatPersisted(this.stat, stat);
        }
        return new ChangeRecord(zxid, path, stat, childCount, acl == null ? new ArrayList<>() : new ArrayList<>(acl));
    }

}


protected enum State {
    INITIAL,
    RUNNING,
    SHUTDOWN,
    ERROR
}


初始化函數(shù)
public ZooKeeperServer(FileTxnSnapLog txnLogFactory, int tickTime, int minSessionTimeout, int maxSessionTimeout, int clientPortListenBacklog, ZKDatabase zkDb, String initialConfig) {
    serverStats = new ServerStats(this);
    this.txnLogFactory = txnLogFactory;
    this.txnLogFactory.setServerStats(this.serverStats);
    this.zkDb = zkDb;
    this.tickTime = tickTime;
    setMinSessionTimeout(minSessionTimeout);
    setMaxSessionTimeout(maxSessionTimeout);
    this.listenBacklog = clientPortListenBacklog;

    listener = new ZooKeeperServerListenerImpl(this);

    readResponseCache = new ResponseCache();

    connThrottle = new BlueThrottle();

    this.initialConfig = initialConfig;

    this.requestPathMetricsCollector = new RequestPathMetricsCollector();

    this.initLargeRequestThrottlingSettings();

    LOG.info("Created server with tickTime " + tickTime
             + " minSessionTimeout " + getMinSessionTimeout()
             + " maxSessionTimeout " + getMaxSessionTimeout()
             + " clientPortListenBacklog " + getClientPortListenBacklog()
             + " datadir " + txnLogFactory.getDataDir()
             + " snapdir " + txnLogFactory.getSnapDir());

}

通過參數(shù)構(gòu)造一個數(shù)據(jù)管理Log FileTxnSnapLog

public ZooKeeperServer(File snapDir, File logDir, int tickTime) throws IOException {
    this(new FileTxnSnapLog(snapDir, logDir), tickTime, "");
}

集群和單機(jī)中加載數(shù)據(jù)

集群調(diào)用順序

Leader#lead

ZooKeeperServer#loadData

單機(jī)調(diào)用順序

ServerCnxFactory#startUp

ZooKeeperServer#startdata

ZooKeeperServer#loadData

單機(jī)版的startData方法

public void startdata() throws IOException, InterruptedException {
    //check to see if zkDb is not null
    if (zkDb == null) {
        zkDb = new ZKDatabase(this.txnLogFactory);//實(shí)例化zkdatabase
    }
    if (!zkDb.isInitialized()) {
        loadData();//沒有初始化就重新初始化
    }
}
//加載數(shù)據(jù)
public void loadData() throws IOException, InterruptedException {
    /*
     * When a new leader starts executing Leader#lead, it
     * invokes this method. The database, however, has been
     * initialized before running leader election so that
     * the server could pick its zxid for its initial vote.
     * It does it by invoking QuorumPeer#getLastLoggedZxid.
     * Consequently, we don't need to initialize it once more
     * and avoid the penalty of loading it a second time. Not
     * reloading it is particularly important for applications
     * that host a large database.
     *
     * The following if block checks whether the database has
     * been initialized or not. Note that this method is
     * invoked by at least one other method:
     * ZooKeeperServer#startdata
     */
     //加載信息
    if (zkDb.isInitialized()) {
        setZxid(zkDb.getDataTreeLastProcessedZxid());
    } else {
        setZxid(zkDb.loadDataBase());
    }

    // Clean up dead sessions
    //獲取超時deadSessions
    List<Long> deadSessions = new ArrayList<>();
    for (Long session : zkDb.getSessions()) {
        if (zkDb.getSessionWithTimeOuts().get(session) == null) {
            deadSessions.add(session);
        }
    }
    //殺掉session
    for (long session : deadSessions) {
        // TODO: Is lastProcessedZxid really the best thing to use?
        killSession(session, zkDb.getDataTreeLastProcessedZxid());
    }

    // Make a clean snapshot 創(chuàng)建快照
    takeSnapshot();
}



刪除會話
protected void killSession(long sessionId, long zxid) {
    zkDb.killSession(sessionId, zxid);
    if (LOG.isTraceEnabled()) {
        ZooTrace.logTraceMessage(
            LOG,
            ZooTrace.SESSION_TRACE_MASK,
            "ZooKeeperServer --- killSession: 0x" + Long.toHexString(sessionId));
    }
    if (sessionTracker != null) {
        sessionTracker.removeSession(sessionId);
    }
}




public synchronized void startup() {
    if (sessionTracker == null) {
        createSessionTracker();
    }
    //責(zé)任鏈處理
    startSessionTracker();
    //設(shè)置請求處理器
    setupRequestProcessors();

    startRequestThrottler();
    //注冊jmx
    registerJMX();

    startJvmPauseMonitor();

    registerMetrics();
    //設(shè)置狀態(tài)
    setState(State.RUNNING);

    requestPathMetricsCollector.start();

    localSessionEnabled = sessionTracker.isLocalSessionsEnabled();
    notifyAll();
}

關(guān)于zk中ZooKeeperServer的作用是什么問題的解答就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道了解更多相關(guān)知識。

分享題目:zk中ZooKeeperServer的作用是什么
URL鏈接:http://aaarwkj.com/article32/pdhepc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供云服務(wù)器企業(yè)網(wǎng)站制作、網(wǎng)站內(nèi)鏈自適應(yīng)網(wǎng)站、靜態(tài)網(wǎng)站、小程序開發(fā)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

小程序開發(fā)
欧美大片黄片在线观看| 亚洲小视频免费在线观看| 日韩成人免费观看视频| 日韩美女av在线播放| 中午字幕久久亚洲精品| 97视频精品免费观看| 午夜视频在线观看黄片| 国产模特一区二区三区| 日韩三级视频一区二区| 最新亚洲国产高清激情| 国产av日韩精品一区二区三区| 久久精品亚洲熟女av蜜謦| 久热99在线视频免费观看| 韩国理伦三级做爰观看| 欧美日韩亚洲中文国产| 偷拍视频一区二区三区| 国内精品自拍亚洲视频| 女人裸体网站无遮挡午夜| 欧美日韩国产一区二区三区在线观看| 黄色免费大片在线播放| 国产亚洲欧美日韩网站| 中文字幕国产精品91| 国产三级全黄在线播放| 成人在线午夜你懂的视频| 亚洲精品国产熟女高潮| 日本久久精品视频一区| 加勒比中文字幕日本道| 国产老熟女不带套91| 日韩在线视频精品一区| 日韩一级片精品视频在线| 色婷婷激情一区二区三区| 国产精品一级自拍视频| 深夜福利视频一区二区| 亚洲综合福利视频网站| 中文字幕有码高清在线| 亚州无吗一区二区三区| 国产又爽又乱的视频在线| 欧美大片黄片在线观看| 欧美亚洲另类国产精品| 日韩一二卡在线观看视频| 午夜在线精品福利视频|