EphemeralNodeDeletionTest.java 文件源码

java
阅读 84 收藏 0 点赞 0 评论 0

项目:https-github.com-apache-zookeeper 作者:
@Override
protected Follower makeFollower(FileTxnSnapLog logFactory)
        throws IOException {
    return new Follower(this, new FollowerZooKeeperServer(logFactory,
            this, this.getZkDb())) {

        @Override
        void readPacket(QuorumPacket pp) throws IOException {
            /**
             * In real scenario got SocketTimeoutException while reading
             * the packet from leader because of network problem, but
             * here throwing SocketTimeoutException based on whether
             * error is injected or not
             */
            super.readPacket(pp);
            if (injectError && pp.getType() == Leader.PROPOSAL) {
                String type = LearnerHandler.packetToString(pp);
                throw new SocketTimeoutException(
                        "Socket timeout while reading the packet for operation "
                                + type);
            }
        }

    };
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号